From 84b44b8394ae458b2ffd61ee0ee5db245f21a11e Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:18:02 +0100 Subject: [PATCH 01/10] Update orders.yml --- models/marts/customer360/orders.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/marts/customer360/orders.yml b/models/marts/customer360/orders.yml index a4e3cc5..215eb09 100644 --- a/models/marts/customer360/orders.yml +++ b/models/marts/customer360/orders.yml @@ -60,7 +60,7 @@ semantic_models: expr: customer_id dimensions: - name: ordered_at - expr: ordered_at + expr: cast(ordered_at as DATETIME) type: time type_params: time_granularity: day @@ -152,4 +152,4 @@ metrics: type_params: measure: order_count window: 7 days -# // test \ No newline at end of file +# // test From 98d50ab60a7e2862d2f5fe303ce8135de86d9377 Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:24:54 +0100 Subject: [PATCH 02/10] Update customers.yml --- models/marts/customer360/customers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/models/marts/customer360/customers.yml b/models/marts/customer360/customers.yml index 80c288d..8aa2a7c 100644 --- a/models/marts/customer360/customers.yml +++ b/models/marts/customer360/customers.yml @@ -43,6 +43,7 @@ semantic_models: type: categorical - name: first_ordered_at type: time + expr: cast(first_orderered_at as DATETIME) type_params: time_granularity: day - name: last_ordered_at From f4ef58ec7495bbc4a1592af3d9427bf2d310611f Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:31:03 +0100 Subject: [PATCH 03/10] Update customers.yml --- models/marts/customer360/customers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/marts/customer360/customers.yml b/models/marts/customer360/customers.yml index 8aa2a7c..bd1cbcd 100644 --- a/models/marts/customer360/customers.yml +++ b/models/marts/customer360/customers.yml @@ -43,7 +43,7 @@ semantic_models: type: categorical - name: first_ordered_at type: time - expr: cast(first_orderered_at as DATETIME) + expr: cast(first_orderered_at as DATE) type_params: time_granularity: day - name: last_ordered_at From 34ec66e6a7269a6113a6bf4216b763a9af46488f Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:31:19 +0100 Subject: [PATCH 04/10] Update orders.yml --- models/marts/customer360/orders.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/marts/customer360/orders.yml b/models/marts/customer360/orders.yml index 215eb09..ccee230 100644 --- a/models/marts/customer360/orders.yml +++ b/models/marts/customer360/orders.yml @@ -60,7 +60,7 @@ semantic_models: expr: customer_id dimensions: - name: ordered_at - expr: cast(ordered_at as DATETIME) + expr: cast(ordered_at as DATE) type: time type_params: time_granularity: day From 0915f7cca148b7afc9dbbbb1eae5b0f9f376303c Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:31:57 +0100 Subject: [PATCH 05/10] Update order_items.yml --- models/marts/customer360/order_items.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/marts/customer360/order_items.yml b/models/marts/customer360/order_items.yml index f577416..594cfe6 100644 --- a/models/marts/customer360/order_items.yml +++ b/models/marts/customer360/order_items.yml @@ -17,7 +17,7 @@ semantic_models: expr: product_id dimensions: - name: ordered_at - expr: cast(ordered_at as DATETIME) + expr: cast(ordered_at as DATE) type: time type_params: time_granularity: day From d9a73d6a3a6e5ba33cca251776df6e406ecdb3e0 Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:34:30 +0100 Subject: [PATCH 06/10] Update order_items.yml --- models/marts/customer360/order_items.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/models/marts/customer360/order_items.yml b/models/marts/customer360/order_items.yml index 594cfe6..9c52936 100644 --- a/models/marts/customer360/order_items.yml +++ b/models/marts/customer360/order_items.yml @@ -73,11 +73,12 @@ metrics: type_params: measure: order_cost - name: median_revenue - description: The median revenue for each order item. Excludes tax. - type: simple - label: Median Revenue - type_params: - measure: median_revenue + description: The median revenue generated for each order item. + agg: percentile + agg_params: + percentile: .5 + use_approximate_percentile: True + expr: product_price - name: food_revenue description: The revenue from food in each order label: Food Revenue From 548e25dcb9991f55e460db2c511a365a464b5a62 Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 17 Jul 2024 17:38:01 -0700 Subject: [PATCH 07/10] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5b0f807..b6dc0cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -dbt-metricflow[snowflake]==0.0.5 +dbt-core +dbt-snowflake pre-commit~=3.0.4 sqlfluff-templater-dbt~=2.0.0a5 sqlfluff~=2.0.0a5 From 7e7350b40b8c5fb4565a513dbbb9f04980bdad4c Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:38:57 +0100 Subject: [PATCH 08/10] Update order_items.yml --- models/marts/customer360/order_items.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/models/marts/customer360/order_items.yml b/models/marts/customer360/order_items.yml index 9c52936..160db32 100644 --- a/models/marts/customer360/order_items.yml +++ b/models/marts/customer360/order_items.yml @@ -41,7 +41,10 @@ semantic_models: expr: case when is_drink_item = 1 then product_price else 0 end - name: median_revenue description: The median revenue generated for each order item. - agg: median + agg: percentile + agg_params: + percentile: .5 + use_approximate_percentile: True expr: product_price groups: @@ -73,12 +76,11 @@ metrics: type_params: measure: order_cost - name: median_revenue - description: The median revenue generated for each order item. - agg: percentile - agg_params: - percentile: .5 - use_approximate_percentile: True - expr: product_price + description: The median revenue for each order item. Excludes tax. + type: simple + label: Median Revenue + type_params: + measure: median_revenue - name: food_revenue description: The revenue from food in each order label: Food Revenue From 352c6eb474f6d6d44427a46ec1252e92a0c50770 Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 17 Jul 2024 17:42:39 -0700 Subject: [PATCH 09/10] Update order_items.yml --- models/marts/customer360/order_items.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/marts/customer360/order_items.yml b/models/marts/customer360/order_items.yml index 160db32..f1e4482 100644 --- a/models/marts/customer360/order_items.yml +++ b/models/marts/customer360/order_items.yml @@ -128,8 +128,8 @@ metrics: type: cumulative type_params: measure: revenue - cumulative_type_params: - period_agg: last + # cumulative_type_params: + # period_agg: last saved_queries: - name: order_metrics From 86266766592129acfbe1e406a59683eb280030f9 Mon Sep 17 00:00:00 2001 From: rpourzand Date: Thu, 18 Jul 2024 01:48:28 +0100 Subject: [PATCH 10/10] Update customers.yml --- models/marts/customer360/customers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/marts/customer360/customers.yml b/models/marts/customer360/customers.yml index bd1cbcd..0938931 100644 --- a/models/marts/customer360/customers.yml +++ b/models/marts/customer360/customers.yml @@ -43,7 +43,7 @@ semantic_models: type: categorical - name: first_ordered_at type: time - expr: cast(first_orderered_at as DATE) + expr: cast(first_ordered_at as DATE) type_params: time_granularity: day - name: last_ordered_at