forked from llooker/demo_segment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
funnel_explorer.view.lkml
145 lines (122 loc) · 2.9 KB
/
funnel_explorer.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
view: funnel_explorer {
derived_table: {
sql: SELECT tracks_sessions_map.session_id as session_id
, MIN(
CASE WHEN
{% condition event1 %} tracks_sessions_map.event {% endcondition %}
THEN tracks_sessions_map.received_at
ELSE NULL END
) as event1_time
, MIN(
CASE WHEN
{% condition event2 %} tracks_sessions_map.event {% endcondition %}
THEN tracks_sessions_map.received_at
ELSE NULL END
) as event2_time
, MIN(
CASE WHEN
{% condition event3 %} tracks_sessions_map.event {% endcondition %}
THEN tracks_sessions_map.received_at
ELSE NULL END
) as event3_time
FROM ${track_facts.SQL_TABLE_NAME} as tracks_sessions_map
GROUP BY 1
;;
}
filter: event1 {
suggest_explore: event_list
suggest_dimension: event_list.event_types
}
filter: event2 {
suggest_explore: event_list
suggest_dimension: event_list.event_types
}
filter: event3 {
suggest_explore: event_list
suggest_dimension: event_list.event_types
}
dimension: session_id {
type: string
primary_key: yes
sql: ${TABLE}.session_id ;;
}
dimension_group: event1 {
type: time
timeframes: [raw, time]
sql: ${TABLE}.event1_time ;;
}
dimension_group: event2 {
type: time
timeframes: [raw, time]
sql: ${TABLE}.event2_time ;;
}
dimension_group: event3 {
type: time
timeframes: [raw, time]
sql: ${TABLE}.event3_time ;;
}
dimension: event1_before_event2 {
type: yesno
sql: ${event1_time} < ${event2_time} ;;
}
dimension: event2_before_event3 {
type: yesno
sql: ${event2_time} < ${event3_time} ;;
}
dimension: minutes_in_funnel {
type: number
sql: datediff(min,${event1_raw},COALESCE(${event3_raw},${event2_raw})) ;;
}
measure: count_sessions {
type: count_distinct
sql: ${session_id} ;;
}
measure: count_sessions_event1 {
type: count_distinct
sql: ${session_id} ;;
filters: {
field: event1_time
value: "NOT NULL"
}
}
measure: count_sessions_event12 {
type: count_distinct
sql: ${session_id} ;;
filters: {
field: event1_time
value: "NOT NULL"
}
filters: {
field: event2_time
value: "NOT NULL"
}
filters: {
field: event1_before_event2
value: "true"
}
}
measure: count_sessions_event123 {
type: count_distinct
sql: ${session_id} ;;
filters: {
field: event1_time
value: "NOT NULL"
}
filters: {
field: event2_time
value: "NOT NULL"
}
filters: {
field: event3_time
value: "NOT NULL"
}
filters: {
field: event1_before_event2
value: "true"
}
filters: {
field: event2_before_event3
value: "true"
}
}
}