-
Notifications
You must be signed in to change notification settings - Fork 0
/
order_items.view.lkml
71 lines (61 loc) · 1.22 KB
/
order_items.view.lkml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
view: order_items {
sql_table_name: demo_db.order_items ;;
dimension: id {
primary_key: yes
type: number
sql: ${TABLE}.id ;;
}
dimension: inventory_item_id {
type: number
# hidden: yes
sql: ${TABLE}.inventory_item_id ;;
}
dimension: order_id {
type: number
# hidden: yes
sql: ${TABLE}.order_id ;;
}
dimension_group: returned {
type: time
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}.returned_at ;;
}
dimension: sale_price {
type: number
# value_format: "0.000"
sql: ${TABLE}.sale_price ;;
}
dimension: 100orno {
type: number
sql: CASE WHEN ${TABLE}.sale_price > 100 THEN 100
WHEN ${TABLE}.sale_price > 50 THEN -100
ELSE 0 END;;
}
#
# dimension: pivot_yesno {
# type: yesno
# sql: ${sale_price} > 50 ;;
# }
measure: sale_price_average {
type: average
value_format: "0.###"
sql: ${sale_price} ;;
}
measure: 100orno_avg {
type: average
sql: ${100orno} ;;
value_format: "0.000"
}
measure: weird_measure {
type: string
sql: SUBSTR(CAST(SEC_TO_TIME(${sale_price_average}) AS CHAR), 4, 5) ;;
}
}