-
Notifications
You must be signed in to change notification settings - Fork 4
/
user_order_facts.view.lkml
76 lines (66 loc) · 2.43 KB
/
user_order_facts.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
view: user_order_facts {
derived_table: {
sql_trigger_value: SELECT COUNT(*) FROM ${impression_funnel.SQL_TABLE_NAME} ;;
sql: SELECT
impression_funnel.user_id AS impression_funnel_user_id,
impression_funnel.campaign_id AS impression_funnel_order_id,
min(impression_funnel.first_activity) AS first_campaign_activity_date,
min(impression_funnel.first_click) AS first_campaign_click_date,
min(impression_funnel.first_impression) AS first_campaign_impression_date,
max(impression_funnel.latest_click) AS latest_campaign_click_date,
max(impression_funnel.latest_activity) AS latest_campaign_activity_date,
max(impression_funnel.latest_impression) AS latest_campaign_impression_date
FROM ${impression_funnel.SQL_TABLE_NAME} AS impression_funnel
GROUP BY 1,2
;;
}
dimension: user_id {
type: string
hidden: yes
sql: ${TABLE}.impression_funnel_user_id ;;
}
dimension: order_id {
type: string
hidden: yes
sql: ${TABLE}.impression_funnel_campaign_id ;;
}
dimension_group: first_campaign_activity {
type: time
datatype: epoch
sql: cast(${TABLE}.first_campaign_activity_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
dimension_group: first_campaign_click {
type: time
datatype: epoch
sql: cast(${TABLE}.first_campaign_click_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
dimension_group: first_campaign_impression {
type: time
datatype: epoch
sql: cast(${TABLE}.first_campaign_impression_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
dimension_group: latest_campaign_click {
type: time
datatype: epoch
sql: cast(${TABLE}.latest_campaign_click_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
dimension_group: latest_campaign_activity {
type: time
datatype: epoch
sql: cast(${TABLE}.latest_campaign_activity_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
dimension_group: latest_campaign_impression {
type: time
datatype: epoch
sql: cast(${TABLE}.latest_campaign_impression_date/1000000 as int64) ;;
timeframes: [date, week, month, year]
}
set: detail {
fields: [first_campaign_activity_date, first_campaign_click_date, first_campaign_impression_date, latest_campaign_click_date, latest_campaign_activity_date, latest_campaign_impression_date]
}
}