From 08e73915fea23cb3d9f076b5201f1e4c97156b54 Mon Sep 17 00:00:00 2001 From: Angelina Jolie Date: Thu, 26 Sep 2024 17:27:09 +0000 Subject: [PATCH 1/2] check out branch --- models/marts/customers.yml | 5 +++++ package-lock.yml | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 models/marts/customers.yml diff --git a/models/marts/customers.yml b/models/marts/customers.yml new file mode 100644 index 0000000..aeb30d9 --- /dev/null +++ b/models/marts/customers.yml @@ -0,0 +1,5 @@ +semantic_models: + - name: customers + model: ref('customers') + # defaults: + # agg_time_dimension: first_ordered_at \ No newline at end of file diff --git a/package-lock.yml b/package-lock.yml index 3f03b07..8730374 100644 --- a/package-lock.yml +++ b/package-lock.yml @@ -3,6 +3,6 @@ packages: version: 1.1.1 - package: calogica/dbt_date version: 0.10.0 - - package: dbt-labs/audit_helper - version: 0.12.0 -sha1_hash: 974021e878d1894c35a21fb44fb0b6bd04f07078 + - git: https://github.com/dbt-labs/dbt-audit-helper.git + revision: c0be07f84e61dd01517292a15a2c084af9c95f01 +sha1_hash: da0d5b1d5a48f6504805f6b1d5a0b2f9f233f34c From 50c423a007263a8a7ff0d6de71c29dccad5a149a Mon Sep 17 00:00:00 2001 From: Angelina Jolie Date: Thu, 26 Sep 2024 21:11:26 +0000 Subject: [PATCH 2/2] beep boop --- models/marts/customers.yml | 62 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/models/marts/customers.yml b/models/marts/customers.yml index aeb30d9..0a7f7f8 100644 --- a/models/marts/customers.yml +++ b/models/marts/customers.yml @@ -1,5 +1,63 @@ semantic_models: - name: customers model: ref('customers') - # defaults: - # agg_time_dimension: first_ordered_at \ No newline at end of file + defaults: + agg_time_dimension: first_ordered_at + entities: + - name: customer + type: primary + expr: customer_id + dimensions: + - name: customer_name + type: categorical + - name: customer_type + type: categorical + - name: first_ordered_at + type: time + type_params: + time_granularity: day + - name: last_ordered_at + type: time + type_params: + time_granularity: day + measures: + - name: customers + description: Count of unique customers + agg: count_distinct + - name: count_lifetime_orders + description: Total count of orders per customer. + agg: sum + - name: lifetime_spend_pretax + description: Customer lifetime spend before taxes. + agg: sum + - name: lifetime_spend + description: Gross customer lifetime spend inclusive of taxes. + agg: sum +metrics: + - name: lifetime_spend_pretax + description: Customer's lifetime spend before tax + label: LTV Pre-tax + type: simple + type_params: + measure: lifetime_spend_pretax + - name: count_lifetime_orders + description: Count of lifetime orders + label: Count Lifetime Orders + type: simple + type_params: + measure: count_lifetime_orders + - name: average_order_value + description: LTV pre-tax / number of orders + label: Average Order Value + type: derived + type_params: + expr: lifetime_spend_pretax / count_lifetime_orders + metrics: + - count_lifetime_orders + - lifetime_spend_pretax + + + + + +