Skip to content
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

Update orders.yml #72

Merged
merged 10 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/marts/customer360/customers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ semantic_models:
type: categorical
- name: first_ordered_at
type: time
expr: cast(first_ordered_at as DATE)
type_params:
time_granularity: day
- name: last_ordered_at
Expand Down
11 changes: 7 additions & 4 deletions models/marts/customer360/order_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -125,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
Expand Down
4 changes: 2 additions & 2 deletions models/marts/customer360/orders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ semantic_models:
expr: customer_id
dimensions:
- name: ordered_at
expr: ordered_at
expr: cast(ordered_at as DATE)
type: time
type_params:
time_granularity: day
Expand Down Expand Up @@ -152,4 +152,4 @@ metrics:
type_params:
measure: order_count
window: 7 days
# // test
# // test
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Loading