-
Notifications
You must be signed in to change notification settings - Fork 4
/
04_products.view.lkml
95 lines (76 loc) · 2.37 KB
/
04_products.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
view: products {
sql_table_name: products ;;
dimension: id {
primary_key: yes
type: number
sql: ${TABLE}.id ;;
}
dimension: category {
sql: TRIM(${TABLE}.category) ;;
drill_fields: [item_name]
}
dimension: item_name {
sql: TRIM(${TABLE}.name) ;;
}
dimension: brand {
sql: TRIM(${TABLE}.brand) ;;
link: {
label: "Website"
url: "http://www.google.com/search?q={{ value | encode_uri }}+clothes&btnI"
icon_url: "http://www.google.com/s2/favicons?domain=www.{{ value | encode_uri }}.com"
}
link: {
label: "Facebook"
url: "http://www.google.com/search?q=site:facebook.com+{{ value | encode_uri }}+clothes&btnI"
icon_url: "https://static.xx.fbcdn.net/rsrc.php/yl/r/H3nktOa7ZMg.ico"
}
link: {
label: "{{value}} Analytics Dashboard"
url: "/dashboards/thelook::brand_analytics?Brand%20Name={{ value | encode_uri }}"
icon_url: "http://www.looker.com/favicon.ico"
}
drill_fields: [category, item_name]
}
dimension: retail_price {
type: number
sql: ${TABLE}.retail_price ;;
}
dimension: department {
sql: TRIM(${TABLE}.department) ;;
}
dimension: sku {
sql: ${TABLE}.sku ;;
}
dimension: distribution_center_id {
type: number
sql: ${TABLE}.distribution_center_id ;;
}
## MEASURES ##
measure: count {
type: count
drill_fields: [detail*]
}
measure: brand_count {
type: count_distinct
sql: ${brand} ;;
drill_fields: [brand, detail2*, -brand_count] # show the brand, a bunch of counts (see the set below), don't show the brand count, because it will always be 1
}
measure: category_count {
alias: [category.count]
type: count_distinct
sql: ${category} ;;
drill_fields: [category, detail2*, -category_count] # don't show because it will always be 1
}
measure: department_count {
alias: [department.count]
type: count_distinct
sql: ${department} ;;
drill_fields: [department, detail2*, -department_count] # don't show because it will always be 1
}
set: detail {
fields: [id, item_name, brand, category, department, retail_price, customers.count, orders.count, order_items.count, inventory_items.count]
}
set: detail2 {
fields: [category_count, brand_count, department_count, count, customers.count, orders.count, order_items.count, inventory_items.count, products.count]
}
}