Skip to content

Commit 4f09f03

Browse files
committed
use original columns instead of the converted_xxx columns
1 parent 6cfa74c commit 4f09f03

9 files changed

Lines changed: 25 additions & 23 deletions

File tree

reports/chargebacks_daily/v_report_chargebacks_daily.ddl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select
33
ac.tenant_record_id
44
, date_format(ac.created_date,'%Y-%m-%d') as day
55
, ac.currency
6-
, sum(ac.converted_amount) as count
6+
, sum(ac.amount) as count
77
from
88
analytics_payment_chargebacks ac
99
where 1=1

reports/conversion-total-dollar-amount/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ curl -v \
3232
|6| 2025-01-01 |ANNUAL|200|
3333
|1| 2025-04-01 |MONTHLY|30|
3434

35-
Here `day` represents the first day of the month representing that subscription's conversion month. So if the subscription converts from TRIAL to EVERGREEN phase on `2025-04-15`, the day will be `2025-04-01`. The first row in the above table means that in the month of June, a revenue of `$30` was generated when `WEEKLY` subscriptions moved out of `TRIAL`.
35+
Here `day` represents the first day of the month representing that subscription's conversion month. So if the subscription converts from TRIAL to EVERGREEN phase on `2025-04-15`, the `day` value will be `2025-04-01`. The first row in the above table indicates that in the month of June, a revenue of `$30` was generated when `WEEKLY` subscriptions moved out of `TRIAL` phase.
3636

3737
## Report UI:
3838

reports/invoice_item_adjustments_daily/v_report_invoice_item_adjustments_daily.ddl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select
33
aiia.tenant_record_id
44
, aiia.currency
55
, date_format(aiia.created_date,'%Y-%m-%d') as day
6-
, sum(aiia.converted_amount) as count
6+
, sum(aiia.amount) as count
77
from
88
analytics_invoice_item_adjustments aiia
99
where 1=1

reports/invoices_balance_daily/v_report_invoices_balance_daily.ddl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select
33
ai.tenant_record_id
44
, ai.currency
55
, date_format(ai.created_date,'%Y-%m-%d') as day
6-
, sum(ai.converted_balance) as count
6+
, sum(ai.balance) as count
77
from
88
analytics_invoices ai
99
where 1=1

reports/invoices_daily/v_report_invoices_daily.ddl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select
33
ai.tenant_record_id
44
, date_format(ai.created_date,'%Y-%m-%d') as day
55
, ai.currency
6-
, sum(ai.converted_original_amount_charged) as count
6+
, sum(ai.original_amount_charged) as count
77
from
88
analytics_invoices ai
99
where 1=1

reports/mrr/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ curl -v \
2424

2525
## Sample Data
2626

27-
| tenant_record_id | product | day | count |
28-
| ---------------- | ------- | ---------- |--------|
29-
| 24 | Pistol | 2025-01-05 | 150.00 |
30-
| 24 | Rifle | 2025-01-05 | 200.00 |
31-
| 24 | ALL | 2025-01-05 | 350.00 |
32-
| 24 | Pistol | 2025-01-06 | 150.00 |
33-
| 24 | ALL | 2025-01-06 | 150.00 |
27+
| tenant_record_id | currency | product | day | count |
28+
|------------------|----------|---------------|------------|----------|
29+
| 1 | USD | Pistol | 2025-08-07 | 224.6292 |
30+
| 1 | USD | Blowdart | 2025-08-07 | 29.9500 |
31+
| 1 | EUR | Knife | 2025-08-07 | 29.9500 |
32+
| 1 | USD | Assault-Rifle | 2025-08-07 | 499.9958 |
33+
| 2 | USD | Pistol | 2025-08-07 | 100.0000 |
34+
| 2 | USD | All | 2025-08-07 | 100.0000 |
3435

3536

36-
TODO: - add currency to view??
37-
// The first row in the above table indicates that on the date `2025-01-05`, the MRR for the `Pistol` product was $150 for `tenant_record_id=1`.
37+
The first row in the above table indicates that on the date `2025-08-07`, the MRR for the `Pistol` product was $150 for `tenant_record_id=1`.
3838

3939
## Report UI:
4040

reports/mrr/v_report_mrr_daily.ddl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
create or replace view v_report_mrr_daily as
22
select
33
ast.tenant_record_id
4+
, ast.next_currency as currency
45
, ifnull(ast.next_product_name, ast.prev_product_name) as product
56
, date_format(cal.d,'%Y-%m-%d') as day
6-
, sum(ast.converted_next_mrr) as count
7+
, sum(ast.next_mrr) as count
78
from
89
calendar cal
910
left join analytics_subscription_transitions ast on cast(date_format(ast.next_start_date, '%Y-%m-%d') as date) <= cast(date_format(cal.d, '%Y-%m-%d') as date)
@@ -13,12 +14,13 @@ where 1=1
1314
and ast.report_group='default'
1415
and ast.next_service='entitlement-service'
1516
and ifnull(ast.next_mrr, 0) > 0
16-
group by 1,2,3
17+
group by 1,2,3,4
1718
union select
1819
ast.tenant_record_id
20+
, ast.next_currency as currency
1921
, 'ALL' as product
2022
, date_format(cal.d,'%Y-%m-%d') as day
21-
, sum(ast.converted_next_mrr) as count
23+
, sum(ast.next_mrr) as count
2224
from
2325
calendar cal
2426
left join analytics_subscription_transitions ast on cast(date_format(ast.next_start_date, '%Y-%m-%d') as date) <= cast(date_format(cal.d, '%Y-%m-%d') as date)
@@ -28,5 +30,5 @@ where 1=1
2830
and ast.report_group='default'
2931
and ast.next_service='entitlement-service'
3032
and ifnull(ast.next_mrr, 0) > 0
31-
group by 1,2,3
32-
;
33+
group by 1,2,3,4
34+
;

reports/payments_total_daily/v_report_payments_total_daily.ddl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ select
33
tenant_record_id,
44
date_format(created_date,'%Y-%m-%d') as day,
55
currency,
6-
sum(ifnull(converted_amount, 0)) as count
6+
sum(ifnull(amount, 0)) as count
77
from (
88
select
99
ac.tenant_record_id,
1010
ac.created_date,
1111
ac.currency,
12-
ac.converted_amount
12+
ac.amount
1313
from analytics_payment_captures ac
1414
where ac.payment_transaction_status = 'SUCCESS'
1515
and ac.report_group='default'
@@ -20,7 +20,7 @@ from (
2020
ap.tenant_record_id,
2121
ap.created_date,
2222
ap.currency,
23-
ap.converted_amount
23+
ap.amount
2424
from analytics_payment_purchases ap
2525
where ap.payment_transaction_status = 'SUCCESS'
2626
and ap.report_group='default'

reports/refunds_total_daily/v_report_refunds_total_daily.ddl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select
33
ar.tenant_record_id
44
, date_format(ar.created_date,'%Y-%m-%d') as day
55
, ar.currency as currency
6-
, sum(abs(ar.converted_invoice_amount_refunded)) as count
6+
, sum(abs(ar.invoice_amount_refunded)) as count
77
from
88
analytics_payment_refunds ar
99
where 1=1

0 commit comments

Comments
 (0)