-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththread_ident_parsed.view.lkml
74 lines (73 loc) · 1.88 KB
/
thread_ident_parsed.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
view: thread_ident_parsed {
derived_table: {
sql:
SELECT
id, tid, thread_id,
CONVERT(SUBSTRING_INDEX(ident, '-', 1) USING UTF8) AS session_year,
CONVERT(SUBSTRING_INDEX(ident, '-', -1) USING UTF8) AS print_number
FROM
thread_ident
WHERE ident like '2%' ;;
}
dimension: tid {
description: "Disqus Thread ID"
type: number
value_format_name: id
sql: ${TABLE}.tid ;;
}
dimension: thread_id {
description: "Internal Thread ID"
type: number
value_format_name: id
sql: ${TABLE}.thread_id ;;
}
dimension: session_year {
description: "Session Year"
type: number
value_format_name: id
sql: ${TABLE}.session_year ;;
}
dimension: print_number {
description: "Base Print Number"
type: string
sql: ${TABLE}.print_number ;;
}
}
# view: thread_ident_parsed {
# # Or, you could make this view a derived table, like this:
# derived_table: {
# sql: SELECT
# user_id as user_id
# , COUNT(*) as lifetime_orders
# , MAX(orders.created_at) as most_recent_purchase_at
# FROM orders
# GROUP BY user_id
# ;;
# }
#
# # Define your dimensions and measures here, like this:
# dimension: user_id {
# description: "Unique ID for each user that has ordered"
# type: number
# sql: ${TABLE}.user_id ;;
# }
#
# dimension: lifetime_orders {
# description: "The total number of orders for each user"
# type: number
# sql: ${TABLE}.lifetime_orders ;;
# }
#
# dimension_group: most_recent_purchase {
# description: "The date when each user last ordered"
# type: time
# timeframes: [date, week, month, year]
# sql: ${TABLE}.most_recent_purchase_at ;;
# }
#
# measure: total_lifetime_orders {
# description: "Use this for counting lifetime orders across many users"
# type: sum
# sql: ${lifetime_orders} ;;
# }
# }