From 7a0a56101c5d8659d78ac1bd4975eb3a8db7cdb6 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:20:36 -0500 Subject: [PATCH 1/4] Changing erroneous examples --- website/docs/docs/build/measures.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/website/docs/docs/build/measures.md b/website/docs/docs/build/measures.md index 977b630fada..bf06681ddd7 100644 --- a/website/docs/docs/build/measures.md +++ b/website/docs/docs/build/measures.md @@ -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_date__month --order subscription_date__month +dbt sl query --metrics mrr_by_end_of_month --group-by subscription_date__week --order 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_date__month --order subscription_date__month +mf query --metrics mrr_by_end_of_month --group-by subscription_date__week --order subscription_date__week ``` import SetUpPages from '/snippets/_metrics-dependencies.md'; From 9f01e6b8abfa301b4b900b42d5dc6673136acb03 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:21:29 -0500 Subject: [PATCH 2/4] Reverting change --- website/docs/docs/build/measures.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/docs/build/measures.md b/website/docs/docs/build/measures.md index bf06681ddd7..caf08579547 100644 --- a/website/docs/docs/build/measures.md +++ b/website/docs/docs/build/measures.md @@ -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 subscription_date__month --order subscription_date__month -dbt sl query --metrics mrr_by_end_of_month --group-by subscription_date__week --order subscription_date__week +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 ``` For dbt Core: ```bash -mf query --metrics mrr_by_end_of_month --group-by subscription_date__month --order subscription_date__month -mf query --metrics mrr_by_end_of_month --group-by subscription_date__week --order subscription_date__week +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 ``` import SetUpPages from '/snippets/_metrics-dependencies.md'; From 431237c9dd4f82cc9c3c6e9999d87ea13db66219 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:52:10 -0500 Subject: [PATCH 3/4] More changes --- website/docs/docs/build/measures.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/website/docs/docs/build/measures.md b/website/docs/docs/build/measures.md index caf08579547..5f9ee798abd 100644 --- a/website/docs/docs/build/measures.md +++ b/website/docs/docs/build/measures.md @@ -200,16 +200,16 @@ Parameters under the `non_additive_dimension` will specify dimensions that the m ```yaml semantic_models: - - name: subscription_id + - name: subscription 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') defaults: agg_time_dimension: subscription_date entities: - name: user_id type: foreign - primary_entity: subscription_table + primary_entity: subscription dimensions: - name: subscription_date @@ -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'; From 7da292e9f24a95d68af7e1b6ba593a21032e3461 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:40:10 -0500 Subject: [PATCH 4/4] Apply suggestions from code review --- website/docs/docs/build/measures.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/docs/build/measures.md b/website/docs/docs/build/measures.md index 5f9ee798abd..d60aa3f7e21 100644 --- a/website/docs/docs/build/measures.md +++ b/website/docs/docs/build/measures.md @@ -200,9 +200,9 @@ Parameters under the `non_additive_dimension` will specify dimensions that the m ```yaml semantic_models: - - name: subscription + - name: subscriptions description: A subscription table with one row per date for each active user and their subscription plans. - model: ref('your_schema.subscription') + model: ref('your_schema.subscription_table') defaults: agg_time_dimension: subscription_date