Skip to content
Open
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
3 changes: 3 additions & 0 deletions models/_sales.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ models:
- name: referral_source
- name: cook_id
- name: location_id
- name: order_value_bucket
meta:
hashboard:
alias: orders
Expand All @@ -157,6 +158,8 @@ models:
primaryKey: true
- name: pizza_size
description: pizza size; small, medium or large
- name: pizza_shape
description: shape of the pizza
- name: pizza_type
description: the type of pizza
- name: price
Expand Down
7 changes: 6 additions & 1 deletion models/orders.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
select
select
timestamp,
order_id as id,
payment_method,
delivery,
type,
customer_id,
sum(item_price) as total_order_value,
case
when item_price > 10 then 'high'
when item_price > 5 then 'medium'
else 'low'
end as order_value_bucket,
any_value(loyalty_status) as loyalty_status,
any_value(discount_code) as discount_code,
any_value(feedback_rating) as feedback_rating,
Expand Down