Skip to content

Commit 8716037

Browse files
author
Dan Eisenberg
committed
Change sql and add column
1 parent a1ba6cb commit 8716037

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

models/_sales.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ models:
138138
- name: referral_source
139139
- name: cook_id
140140
- name: location_id
141+
- name: order_value_bucket
141142
meta:
142143
hashboard:
143144
alias: orders

models/orders.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
select
1+
select
22
timestamp,
33
order_id as id,
44
payment_method,
55
delivery,
66
type,
77
customer_id,
88
sum(item_price) as total_order_value,
9+
case
10+
when item_price > 10 then 'high'
11+
when item_price > 5 then 'medium'
12+
else 'low'
13+
end as order_value_bucket,
914
any_value(loyalty_status) as loyalty_status,
1015
any_value(discount_code) as discount_code,
1116
any_value(feedback_rating) as feedback_rating,

0 commit comments

Comments
 (0)