-
Notifications
You must be signed in to change notification settings - Fork 15
/
invoices.view.lkml
145 lines (121 loc) · 2.66 KB
/
invoices.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: invoices {
sql_table_name: stripe.invoices ;;
## Dimensions
dimension: id {
primary_key: yes
type: string
sql: ${TABLE}.id ;;
html: <a href="/dashboards/segment_stripe::invoice_lookup?invoice_id={{ value }}">{{ value }}</a>
;;
}
dimension: amount_due {
type: number
sql: ${TABLE}.amount_due/100.0 ;;
value_format: "[>=1000000]$0.00,,\"M\";[>=1000]$0.00,\"K\";$0.00"
}
dimension: attempt_count {
type: number
sql: ${TABLE}.attempt_count ;;
}
dimension: attempted {
type: yesno
sql: ${TABLE}.attempted ;;
}
dimension: charge_id {
type: string
# hidden: true
sql: ${TABLE}.charge_id ;;
}
dimension: closed {
type: yesno
sql: ${TABLE}.closed ;;
}
dimension: currency {
type: string
sql: ${TABLE}.currency ;;
}
dimension: customer_id {
type: string
# hidden: true
sql: ${TABLE}.customer_id ;;
}
dimension_group: date {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.date ;;
}
dimension: ending_balance {
type: number
sql: ${TABLE}.ending_balance ;;
}
dimension_group: next_payment_attempt {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.next_payment_attempt ;;
}
dimension: paid {
type: yesno
sql: ${TABLE}.paid ;;
}
dimension_group: period_end {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.period_end ;;
}
dimension_group: period_start {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.period_start ;;
}
dimension_group: received {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.received_at ;;
}
dimension: starting_balance {
type: number
sql: ${TABLE}.starting_balance ;;
}
dimension: subscription_id {
type: string
# hidden: true
sql: ${TABLE}.subscription_id ;;
}
dimension: subtotal {
type: number
sql: ${TABLE}.subtotal*1.0/100 ;;
value_format: "$#,##0.00"
}
dimension: total {
type: number
sql: ${TABLE}.total*1.0/100 ;;
value_format: "$#,##0.00"
}
dimension_group: webhooks_delivered {
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.webhooks_delivered_at ;;
}
## Measures
measure: total_amount_due {
type: sum
sql: ${amount_due} ;;
value_format: "$#,##0.00"
}
measure: count {
type: count
drill_fields: [detail*]
}
# ----- Sets of fields for drilling ------
set: detail {
fields: [
id,
charges.id,
subscriptions.id,
charges.created_date,
customers.id,
customers.email,
invoice_items.count
]
}
}