forked from llooker/stripe_block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
charges.view.lookml
153 lines (122 loc) · 3.34 KB
/
charges.view.lookml
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
146
147
148
149
150
151
- view: charges
sql_table_name: stripe.charges
fields:
## Dimensions
- dimension: id
primary_key: true
type: string
sql: ${TABLE}.id
- dimension: amount
type: number
sql: ${TABLE}.amount*1.0/100
value_format: '$#,##0.00'
- dimension: amount_refunded
type: number
sql: ${TABLE}.amount_refunded*1.0/100
value_format: '$#,##0.00'
- dimension: captured
type: yesno
sql: ${TABLE}.captured
- dimension_group: created
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.created
- dimension: currency
type: string
sql: ${TABLE}.currency
- dimension: customer_id
type: string
# hidden: true
sql: ${TABLE}.customer_id
- dimension: dispute_id
type: string
sql: ${TABLE}.dispute_id
- dimension: failure_code
type: string
sql: ${TABLE}.failure_code
- dimension: invoice_id
type: string
# hidden: true
sql: ${TABLE}.invoice_id
- dimension: paid
type: yesno
sql: ${TABLE}.paid
- dimension_group: received
type: time
timeframes: [time, date, week, month]
sql: ${TABLE}.received_at
- dimension: refunded
type: yesno
sql: ${TABLE}.refunded
- dimension: status
type: string
sql: ${TABLE}.status
## Measures
- dimension: days_until_received
type: number
sql: datediff('days',${created_date},${received_date})
- measure: avg_days_until_received
type: avg
sql: ${days_until_received}
value_format: '#0.00'
drill_fields: detail*
- measure: total_gross_amount
type: sum
sql: ${amount}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
drill_fields: detail*
- measure: total_failed_charges
type: sum
sql: ${amount}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
drill_fields: detail*
filters:
status: 'failed'
- measure: total_refunds
type: sum
sql: ${amount_refunded}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
drill_fields: detail*
- measure: total_net_amount
type: number
sql: ${total_gross_amount} - ${total_refunds} - ${total_failed_charges}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
drill_fields: detail*
- measure: cumulative_gross
type: running_total
sql: ${total_gross_amount}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
- measure: cumulative_refunds
type: running_total
sql: ${total_refunds}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
- measure: cumulative_net
type: running_total
sql: ${total_net_amount}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
- measure: avg_charge_amount
type: avg
sql: ${total_gross_amount} - ${total_refunds} - ${total_failed_charges}
value_format: '[>=1000000]$0.00,,"M";[>=1000]$0.00,"K";$0.00'
- measure: charge_count
type: count
drill_fields: detail*
- measure: refund_count
type: count
drill_fields: [id, customers.id, invoices.id, invoices.count, refunds.count]
filters:
refunded: 'Yes'
# ----- Sets of fields for drilling ------
sets:
detail:
- id
- captured
- amount
- amount_refunded
- currency
- paid
- invoice_id
- failure_code
- received
- created_time
- customers.email