@@ -200,7 +200,7 @@ Parameters under the `non_additive_dimension` will specify dimensions that the m
200
200
201
201
` ` ` yaml
202
202
semantic_models:
203
- - name: subscription_id
203
+ - name: subscriptions
204
204
description: A subscription table with one row per date for each active user and their subscription plans.
205
205
model: ref('your_schema.subscription_table')
206
206
defaults:
@@ -209,7 +209,7 @@ semantic_models:
209
209
entities:
210
210
- name: user_id
211
211
type: foreign
212
- primary_entity: subscription_table
212
+ primary_entity: subscription
213
213
214
214
dimensions:
215
215
- name: subscription_date
@@ -224,21 +224,21 @@ semantic_models:
224
224
expr: user_id
225
225
agg: count_distinct
226
226
non_additive_dimension:
227
- name: metric_time
227
+ name: subscription_date
228
228
window_choice: max
229
229
- name: mrr
230
230
description: Aggregate by summing all users' active subscription plans
231
231
expr: subscription_value
232
232
agg: sum
233
233
non_additive_dimension:
234
- name: metric_time
234
+ name: subscription_date
235
235
window_choice: max
236
236
- name: user_mrr
237
237
description: Group by user_id to achieve each user's MRR
238
238
expr: subscription_value
239
239
agg: sum
240
240
non_additive_dimension:
241
- name: metric_time
241
+ name: subscription_date
242
242
window_choice: max
243
243
window_groupings:
244
244
- user_id
@@ -255,15 +255,15 @@ We can query the semi-additive metrics using the following syntax:
255
255
For dbt Cloud :
256
256
257
257
` ` ` bash
258
- dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month
259
- dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week
258
+ dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month
259
+ dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week
260
260
` ` `
261
261
262
262
For dbt Core :
263
263
264
264
` ` ` bash
265
- mf query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month
266
- mf query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week
265
+ mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month
266
+ mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week
267
267
` ` `
268
268
269
269
import SetUpPages from '/snippets/_metrics-dependencies.md';
0 commit comments