-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metric date #6428
Metric date #6428
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,16 +200,16 @@ Parameters under the `non_additive_dimension` will specify dimensions that the m | |
|
||
```yaml | ||
semantic_models: | ||
- name: subscription_id | ||
- name: subscription | ||
matthewshaver marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description: A subscription table with one row per date for each active user and their subscription plans. | ||
model: ref('your_schema.subscription_table') | ||
model: ref('your_schema.subscription') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can leave this how it was! The table name doesn't need to match the semantic model name.
matthewshaver marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defaults: | ||
agg_time_dimension: subscription_date | ||
|
||
entities: | ||
- name: user_id | ||
type: foreign | ||
primary_entity: subscription_table | ||
primary_entity: subscription | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏼 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and everything below looks good! |
||
|
||
dimensions: | ||
- name: subscription_date | ||
|
@@ -224,21 +224,21 @@ semantic_models: | |
expr: user_id | ||
agg: count_distinct | ||
non_additive_dimension: | ||
name: metric_time | ||
name: subscription_date | ||
window_choice: max | ||
- name: mrr | ||
description: Aggregate by summing all users' active subscription plans | ||
expr: subscription_value | ||
agg: sum | ||
non_additive_dimension: | ||
name: metric_time | ||
name: subscription_date | ||
window_choice: max | ||
- name: user_mrr | ||
description: Group by user_id to achieve each user's MRR | ||
expr: subscription_value | ||
agg: sum | ||
non_additive_dimension: | ||
name: metric_time | ||
name: subscription_date | ||
window_choice: max | ||
window_groupings: | ||
- user_id | ||
|
@@ -255,15 +255,15 @@ We can query the semi-additive metrics using the following syntax: | |
For dbt Cloud: | ||
|
||
```bash | ||
dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month | ||
dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week | ||
dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month | ||
dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week | ||
``` | ||
|
||
For dbt Core: | ||
|
||
```bash | ||
mf query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month | ||
mf query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week | ||
mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month | ||
mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week | ||
``` | ||
|
||
import SetUpPages from '/snippets/_metrics-dependencies.md'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this
subscriptions
(plural)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely