Merged PR 4757: Creates a Total Booking Fees metric (Old dash + New dash)
# Description Main Changes: * Computes the total booking fees in `int_kpis__metric_daily_invoiced_revenue` * Propagates within KPIs, including schema and tests * Propagates within cross in both "by deal" and "by dimension/global" * Propagates to main kpis tests Small fix: * In `int_mtd_vs_previous_year_metrics`, manual formatting because sqlfmt is broken on this model... # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #28560
This commit is contained in:
parent
93b31854f7
commit
098ab51439
12 changed files with 101 additions and 8 deletions
|
|
@ -166,6 +166,7 @@ select
|
|||
invoiced_revenue.xero_sex_offenders_check_net_fees_in_gbp,
|
||||
invoiced_revenue.xero_protection_pro_net_fees_in_gbp,
|
||||
-- GLOBAL --
|
||||
invoiced_revenue.xero_booking_net_fees_in_gbp,
|
||||
invoiced_revenue.xero_operator_net_fees_in_gbp,
|
||||
|
||||
-- APIs REVENUE --
|
||||
|
|
|
|||
|
|
@ -422,6 +422,15 @@
|
|||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
{
|
||||
"order_by": 224,
|
||||
"metric": "Invoiced Total Booking Fees Revenue",
|
||||
"value": "xero_booking_net_fees_in_gbp",
|
||||
"previous_year_value": "previous_year_xero_booking_net_fees_in_gbp",
|
||||
"relative_increment": "relative_increment_xero_booking_net_fees_in_gbp",
|
||||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
{
|
||||
"order_by": 225,
|
||||
"metric": "Invoiced Old Dashboard Booking Fees Revenue",
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ with
|
|||
invoiced_revenue.xero_sex_offenders_check_net_fees_in_gbp,
|
||||
invoiced_revenue.xero_protection_pro_net_fees_in_gbp,
|
||||
-- GLOBAL --
|
||||
invoiced_revenue.xero_booking_net_fees_in_gbp,
|
||||
invoiced_revenue.xero_operator_net_fees_in_gbp,
|
||||
|
||||
-- APIs REVENUE --
|
||||
|
|
@ -267,7 +268,8 @@ with
|
|||
as host_resolution_amount_paid_per_created_booking,
|
||||
{{
|
||||
return_capped_value(
|
||||
"cast(host_resolutions.xero_host_resolution_payment_count as decimal) / created_bookings.created_bookings",
|
||||
"cast(host_resolutions.xero_host_resolution_payment_count as decimal)
|
||||
/ created_bookings.created_bookings",
|
||||
-1,
|
||||
1,
|
||||
)
|
||||
|
|
@ -349,7 +351,17 @@ with
|
|||
) as revenue_retained_in_gbp,
|
||||
{{
|
||||
return_capped_value(
|
||||
"nullif( coalesce(guest_payments.total_guest_payments_in_gbp, 0) + coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0), 0 ) / nullif( coalesce(guest_payments.total_guest_payments_in_gbp, 0) + coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0), 0 )",
|
||||
"nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
,0)
|
||||
/ nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
,0)",
|
||||
-1,
|
||||
1,
|
||||
)
|
||||
|
|
@ -367,7 +379,18 @@ with
|
|||
) as revenue_retained_post_resolutions_in_gbp,
|
||||
{{
|
||||
return_capped_value(
|
||||
"nullif( coalesce(guest_payments.total_guest_payments_in_gbp, 0) + coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0) + coalesce(host_resolutions.xero_host_resolution_amount_paid_in_gbp, 0), 0 ) / nullif( coalesce(guest_payments.total_guest_payments_in_gbp, 0) + coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0) + coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0), 0 )",
|
||||
"nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(host_resolutions.xero_host_resolution_amount_paid_in_gbp, 0)
|
||||
,0)
|
||||
/ nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0),
|
||||
0)",
|
||||
-1,
|
||||
1,
|
||||
)
|
||||
|
|
@ -533,6 +556,7 @@ select
|
|||
{{ calculate_safe_relative_increment("xero_sex_offenders_check_net_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("xero_protection_pro_net_fees_in_gbp") }},
|
||||
-- GLOBAL --
|
||||
{{ calculate_safe_relative_increment("xero_booking_net_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("xero_operator_net_fees_in_gbp") }},
|
||||
|
||||
-- APIs REVENUE --
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue