-
Notifications
You must be signed in to change notification settings - Fork 17
/
_C_page_facts.view.lkml
55 lines (49 loc) · 1.24 KB
/
_C_page_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
view: page_facts {
derived_table: {
sql_trigger_value: select count(*) from ${mapped_events.SQL_TABLE_NAME} ;;
sql: SELECT
e.event_id AS event_id
,e.looker_visitor_id
,e.timestamp
,CASE
WHEN timestamp_diff(LEAD(e.timestamp) OVER(PARTITION BY e.looker_visitor_id ORDER BY e.timestamp), e.timestamp, second) > 30*60 THEN NULL
ELSE timestamp_diff(LEAD(e.timestamp) OVER(PARTITION BY e.looker_visitor_id ORDER BY e.timestamp), e.timestamp, second) END AS lead_idle_time_condition
FROM ${mapped_events.SQL_TABLE_NAME} AS e
;;
}
dimension: event_id {
# hidden: true
primary_key: yes
sql: ${TABLE}.event_id ;;
}
dimension: duration_page_view_seconds {
type: number
sql: ${TABLE}.lead_idle_time_condition ;;
}
dimension: is_last_page {
type: yesno
sql: ${duration_page_view_seconds} is NULL ;;
}
dimension: looker_visitor_id {
hidden: yes
type: string
sql: ${TABLE}.looker_visitor_id ;;
}
dimension_group: timestamp {
hidden: yes
type: time
datatype: timestamp
timeframes: [
raw,
time,
date,
month,
day_of_week,
year
]
sql: ${TABLE}.timestamp ;;
}
set: detail {
fields: [event_id]
}
}