-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_data.view.lkml
118 lines (92 loc) · 2.19 KB
/
user_data.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
view: user_data {
sql_table_name: demo_db.user_data ;;
dimension: id {
primary_key: yes
type: number
sql: ${TABLE}.id ;;
}
filter: yesno_filter {
type: yesno
sql: {% condition yesno_filter %} ${more_than_5_orders} {% endcondition %} ;;
}
measure: money {
type: sum
#html: {% assign var=_filters['dynamic_parameter'] %}{{var}}{{rendered_value}};;
sql: ${total_num_orders} ;;
drill_fields: [yesno_filter, orders, rders]
value_format: "0.00"
}
dimension: other_view {
sql: 1 ;;
}
parameter: dynamic_parameter {
type: unquoted
allowed_value: {
label: "Pound"
value: "£"
}
allowed_value: {
label: "Euro"
value: "€"
}
}
dimension: param_value {
#hidden: yes
type: string
sql: {% parameter dynamic_parameter %} ;;
}
dimension: more_than_5_orders{
type: yesno
sql: ${total_num_orders} > 5 ;;
}
dimension: max_num_orders {
type: number
sql: ${TABLE}.max_num_orders ;;
}
dimension: total_num_orders {
type: number
sql: ${TABLE}.total_num_orders ;;
}
dimension: user_id {
type: number
# hidden: yes
sql: ${TABLE}.user_id ;;
}
dimension: user_id_2 {
type: string
# hidden: yes
sql: to_char(${TABLE}.user_id, '999') ;;
}
dimension: has_ever_ordered {
label: "Has placed an order"
description: "Says 'yes' when the user has ever placed an order, 'no' when the user has never placed an order"
type: yesno
sql: ${total_num_orders} <> 0 ;;
}
dimension: order_tier {
label: "Number of orders (tiered)"
description: "Number of orders by a user broken up into tiers of 0-4, 5-9, 10-14, 15-19, 20-24 and 25+"
type: tier
tiers: [5, 10, 15, 20, 25]
style: integer
sql: ${total_num_orders} ;;
}
dimension: orders {
type: number
sql: ${total_num_orders} ;;
}
measure: rders {
type: sum
sql: ${total_num_orders} ;;
drill_fields: [order_tier]
}
measure: test {
type: number
sql: ${user_data.orders}/${max_num_orders};;
}
measure: count {
hidden: yes
type: count
drill_fields: [id, users.last_name, users.first_name, users.id]
}
}