Merged PR 4309: Cancelled Bookings KPIs rework
# Description Exposes new metrics: * Created Bookings (Excl. Cancelled) * Cancelled Created Bookings * Check Out Bookings (Excl. Cancelled) * Cancelled Check Out Bookings Re-naming of existing metrics: * Created Bookings -> Total Created Bookings * Checkout Bookings -> Total Check Out Bookings Removes exposure of previous Cancelled Bookings. In the monthly by deal model, it's hardcoded still - need to change PBI to remove safely. This will be done later on once we remove the Cancelled Bookings models. Adapts the existing tests on KPIs to accommodate for the changes by including new metrics. Also, I've set the detector to 5 (from 8) since it's been a while this has not triggered thus might be worth the effort to have more detection capabilities. # 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: #24637
This commit is contained in:
parent
cc86565b02
commit
fe3a5c9fe9
6 changed files with 155 additions and 87 deletions
|
|
@ -192,9 +192,19 @@ with
|
|||
d.dimension,
|
||||
d.dimension_value,
|
||||
|
||||
-- BOOKINGS --
|
||||
-- CREATED BOOKINGS --
|
||||
created_bookings.created_bookings,
|
||||
created_bookings.cancelled_created_bookings,
|
||||
created_bookings.not_cancelled_created_bookings,
|
||||
created_bookings.cancelled_created_bookings_rate,
|
||||
|
||||
-- CHECK OUT BOOKINGS --
|
||||
check_out_bookings.check_out_bookings,
|
||||
check_out_bookings.cancelled_check_out_bookings,
|
||||
check_out_bookings.not_cancelled_check_out_bookings,
|
||||
check_out_bookings.cancelled_check_out_bookings_rate,
|
||||
|
||||
-- OTHER BOOKINGS --
|
||||
cancelled_bookings.cancelled_bookings,
|
||||
billable_bookings.billable_bookings,
|
||||
|
||||
|
|
@ -269,10 +279,9 @@ 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
|
||||
1,
|
||||
)
|
||||
}}
|
||||
as host_resolution_payment_per_created_booking_ratio,
|
||||
|
|
@ -350,22 +359,12 @@ 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
|
||||
1,
|
||||
)
|
||||
}} as revenue_retained_ratio,
|
||||
}}
|
||||
as revenue_retained_ratio,
|
||||
|
||||
-- INCOME RETAINED POST RESOLUTIONS--
|
||||
nullif(
|
||||
|
|
@ -378,23 +377,12 @@ 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
|
||||
1,
|
||||
)
|
||||
}} as revenue_retained_post_resolutions_ratio,
|
||||
}}
|
||||
as revenue_retained_post_resolutions_ratio,
|
||||
|
||||
-- ONBOARDING MRR METRIC --
|
||||
onboarding_mrr.expected_mrr_per_deal,
|
||||
|
|
@ -496,9 +484,19 @@ select
|
|||
current.dimension_value,
|
||||
previous_year.date as previous_year_date,
|
||||
|
||||
-- BOOKINGS --
|
||||
-- CREATED BOOKINGS --
|
||||
{{ calculate_safe_relative_increment("created_bookings") }},
|
||||
{{ calculate_safe_relative_increment("cancelled_created_bookings") }},
|
||||
{{ calculate_safe_relative_increment("not_cancelled_created_bookings") }},
|
||||
{{ calculate_safe_relative_increment("cancelled_created_bookings_rate") }},
|
||||
|
||||
-- CHECK OUT BOOKINGS --
|
||||
{{ calculate_safe_relative_increment("check_out_bookings") }},
|
||||
{{ calculate_safe_relative_increment("cancelled_check_out_bookings") }},
|
||||
{{ calculate_safe_relative_increment("not_cancelled_check_out_bookings") }},
|
||||
{{ calculate_safe_relative_increment("cancelled_check_out_bookings_rate") }},
|
||||
|
||||
-- OTHER BOOKINGS --
|
||||
{{ calculate_safe_relative_increment("cancelled_bookings") }},
|
||||
{{ calculate_safe_relative_increment("billable_bookings") }},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue