-
Notifications
You must be signed in to change notification settings - Fork 2
/
demand_forecasting.model.lkml
82 lines (67 loc) · 2.17 KB
/
demand_forecasting.model.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
connection: "looker-private-demo"
include: "/iowa_liquor/*.view.lkml"
include: "/signals/*.view.lkml"
include: "/dashboards/*.dashboard"
persist_for: "24 hours"
explore: liquor_sales_historic_predicted {
group_label: "Retail Demand Forecasting"
view_label: "Liquor Sales"
label: "Iowa Liquor Sales"
}
explore: liquor_sales_predicted {
group_label: "Retail Demand Forecasting"
view_label: "Liquor Sales"
label: "Iowa Liquor Sales (Predicted Only)"
join: brand_rank {
type: inner
relationship: many_to_one
sql_on: ${liquor_sales_predicted.brand} = ${brand_rank.brand} ;;
}
join: metrics {
view_label: "Signals"
type: left_outer
relationship: many_to_many
sql_on: ${liquor_sales_predicted.calendar_week} = ${metrics.measurement_week}
AND lower(${liquor_sales_predicted.brand}) = ${metrics.term}
;;
}
join: dma_weight_facts {
view_label: "Signals"
type: left_outer
relationship: many_to_one
sql_on: ${metrics.measurement_week} = ${dma_weight_facts.measurement_week}
AND ${metrics.dma_code} = ${dma_weight_facts.dma_code}
AND ${metrics.term} = ${dma_weight_facts.term};;
}
join: max_measurement_date {
type: inner
view_label: "Signals"
relationship: many_to_one
sql_on: ${max_measurement_date.is_max_week} AND ${metrics.term} = ${max_measurement_date.term} ;;
}
join: holidays {
view_label: "Liquor Sales"
type: full_outer
relationship: many_to_one
sql_on: ${liquor_sales_predicted.calendar_date} = ${holidays.date_date} ;;
sql_where: ((${holidays.type} IN ('Sporting event','Federal Holiday'))
OR ${holidays.name} IN ("Mother's Day", "Father's Day", "Valentine's Day"))
;;
}
}
# map_layer: dma {
# feature_key: "dma_code"
# # url: "https://raw.githubusercontent.com/simzou/nielsen-dma/master/nielsen-mkt-map_simplified.json"
# file: "/signals/dma_(1).json"
# format: topojson
# property_key: "dma_code"
# projection: airy
# }
map_layer: dma {
url: "https://raw.githubusercontent.com/simzou/nielsen-dma/master/nielsentopo.json"
property_key: "id"
}
# map_layer: dma {
# file: "/signals/dma_max.topojson"
# property_key: "dma"
# }