-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrand_info.view.lkml
262 lines (218 loc) · 6.24 KB
/
brand_info.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
view: brand_comparison {
derived_table: {
sql:
SELECT * FROM StockX.adidas
union all
SELECT * FROM StockX.nike
union all
SELECT brand, brand1, item_name, release_date, image_url, size, "s" as category, retail_price, annual_high, annual_low, volatility, total_sale, total_sale_count, last_sale_price, current_highest_bid, average_price, bid_count, ask_count FROM StockX.converse
union all
SELECT brand, brand1, item_name, release_date, image_url, size, "s" as category, retail_price, annual_high, annual_low, volatility, total_sale, total_sale_count, last_sale_price, current_highest_bid, average_price, bid_count, ask_count FROM StockX.off_white;;
}
dimension: brand_comparer {
type: string
sql: CASE WHEN {% condition brand_to_compare %} ${brand} {% endcondition %}
THEN ${brand}
ELSE "All other brands"
END;;
}
filter: brand_to_compare {
type: string
suggest_dimension: brand
}
dimension: compound_pk {
primary_key: yes
hidden: no
sql: CONCAT(${TABLE}.Item_Name, ' ', ${size});;
}
dimension: annual_high {
type: number
sql: ${TABLE}.Annual_High ;;
}
dimension: sell_or_hold {
sql: ${TABLE}.current_highest_bid ;;
html: {% if value > ap %}
<p style="color: black; background-color: lightblue; font-size:100%; text-align:center">{{ rendered_value }}</p>
{% elsif value < ap %}
<p style="color: black; background-color: red; font-size:100%; text-align:center">{{ rendered_value }}</p>
{% endif %};;
}
dimension: annual_low {
type: number
sql: ${TABLE}.Annual_Low ;;
}
dimension: ask_count {
type: number
sql: ${TABLE}.Ask_Count ;;
}
dimension: bid_count {
type: number
sql: ${TABLE}.Bid_Count ;;
}
dimension: brand {
type: string
sql: ${TABLE}.Brand ;;
}
dimension: brand1 {
type: string
sql: ${TABLE}.Brand1 ;;
}
dimension: category {
type: string
sql: ${TABLE}.Category ;;
}
dimension: collab {
type: yesno
sql: ${TABLE}.Brand1 IS NOT Null ;;
}
dimension: current_highest_bid {
type: number
value_format_name: id
sql: ${TABLE}.Current_Highest_Bid ;;
}
dimension: image_url {
type: string
sql: ${TABLE}.Image_URL ;;
}
dimension: image {
type: string
sql: ${TABLE}.Image_URL ;;
html: <img src="{{ value }}" class="center" height = 160 width = 230>;;
}
dimension: image_deet {
type: string
sql: ${TABLE}.Image_URL ;;
html: <img src="{{ value }}" class="center" height = 250 width = 360>;;
}
dimension: item_name {
type: string
sql: ${TABLE}.Item_Name ;;
link: {
label: "Shoe Detail"
url: "https://dcl.dev.looker.com/dashboards/168?Shoe%20Name={{filterable_value}}"
}
drill_fields: [size]
html: <p style="font-size:15px; font-family:monotype; text-align:center;" > {{rendered_value}}</p>;;
}
dimension: item_name_deet {
type: string
sql: ${TABLE}.Item_Name ;;
link: {
label: "Shoe Detail"
url: "https://dcl.dev.looker.com/dashboards/168?Shoe%20Name={{filterable_value}}"
}
drill_fields: [size]
html: <p style="font-size:25px; font-family:monotype; text-align:center;" > {{rendered_value}}</p>;;
}
dimension: last_sale_price {
sql: ${TABLE}.Last_Sale_Price ;;
}
dimension: release {
type: date
sql: CAST(DATE_ADD(CAST(${TABLE}.release_date as DATE), INTERVAL 2000 YEAR) as TIMESTAMP);;
}
# dimension: release_date {
# type: date_time
# sql: ${TABLE}.Release_Date ;;
# }
dimension: retail_price {
type: number
sql: ${TABLE}.Retail_Price ;;
value_format_name: usd_0
}
dimension: size {
type: string
sql: cast(${TABLE}.Size AS string) ;;
}
dimension: shoe_size {
type: number
sql: ${TABLE}.Size ;;
value_format: "0.0"
}
dimension: total_sale {
type: number
sql: ${TABLE}.Total_Sale ;;
drill_fields: [size, adidas_trans.Price]
html: <p style="font-size:15px; font-family:monotype; text-align:center;" > {{rendered_value}}</p>;;
value_format_name: usd_0
}
dimension: test {
sql: 'test, words' ;;
html: {{filterable_value}} ;;
}
dimension: total_sale_count {
type: number
sql: ${TABLE}.Total_Sale_Count ;;
}
dimension: sale_count {
sql: ${TABLE}.Total_Sale_Count ;;
html: {% if value < 20 %}
<p style="color: black; background-color: orange; font-size:130%; text-align:center">{{ rendered_value }}</p>
{% elsif value < 40 AND > 20 %}
<p style="color: black; background-color: yellow; font-size:130%; text-align:center">{{ rendered_value }}</p>
{% elsif value < 60 AND > 40 %}
<p style="color: black; background-color: lightblue; font-size:130%; text-align:center">{{ rendered_value }}</p>
{% elsif value > 80 %}
<p style="color: black; background-color: lightgreen; font-size:130%; text-align:center">{{ rendered_value }}</p>
{% endif %};;
}
dimension: volatility {
type: number
sql: ${TABLE}.Volatility ;;
}
dimension: ap {
sql: ${TABLE}.Average_Price ;;
}
measure: average_price {
type: sum
sql: ${TABLE}.Average_Price ;;
}
measure: total_sales {
type: sum
sql: ${TABLE}.Total_Sale ;;
html: <p style="font-size:15px; font-family:monotype; text-align:center;" > {{value}}</p>;;
value_format_name: usd_0
}
# dimension: test {
# sql: ${image_url} ;;
# html: {{ value }} ;;
# }
measure: ts {
type: sum
sql: ${TABLE}.Total_Sale ;;
html: <p style="font-size:50px; font-family:monotype; text-align:center;" > {{rendered_value}}</p>;;
value_format_name: usd_0
}
measure: count_2016 {
type: count_distinct
sql: ${TABLE}.Item_Name ;;
filters: {
field: release
value: "2016"
}
}
measure: count_2017 {
type: count_distinct
sql: ${TABLE}.Item_Name ;;
filters: {
field: release
value: "2017"
}
}
measure: count_2018 {
type: count_distinct
sql: ${TABLE}.Item_Name ;;
filters: {
field: release
value: "2018"
}
}
measure: total_count {
type: count_distinct
sql: ${TABLE}.Item_Name ;;
}
measure: count {
type: count
drill_fields: [item_name]
}
}