New KPI rates for Main KPIs

This commit is contained in:
Joaquin Ossa 2025-01-23 17:14:36 +01:00
parent d5f36c14df
commit 49a10fe249
2 changed files with 77 additions and 3 deletions

View file

@ -286,6 +286,11 @@ with
-- HOST RESOLUTIONS --
host_resolutions.xero_host_resolution_amount_paid_in_gbp,
host_resolutions.xero_host_resolution_payment_count,
cast(host_resolutions.xero_host_resolution_amount_paid_in_gbp as decimal)
/ created_bookings.created_bookings
as xero_host_resolution_payment_per_booking_in_gbp,
cast(host_resolutions.xero_host_resolution_payment_count as decimal)
/ created_bookings.created_bookings as xero_host_resolution_payment_ratio,
-- GUEST REVENUE AND PAYMENTS --
guest_payments.deposit_fees_in_gbp,
@ -358,6 +363,31 @@ with
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0),
0
) as revenue_retained_in_gbp,
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
) as revenue_retained_ratio,
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
) as revenue_retained_post_resolutions_ratio,
-- INCOME RETAINED POST RESOLUTIONS--
nullif(
@ -526,6 +556,12 @@ select
-- HOST RESOLUTIONS --
{{ calculate_safe_relative_increment("xero_host_resolution_amount_paid_in_gbp") }},
{{ calculate_safe_relative_increment("xero_host_resolution_payment_count") }},
{{
calculate_safe_relative_increment(
"xero_host_resolution_payment_per_booking_in_gbp"
)
}},
{{ calculate_safe_relative_increment("xero_host_resolution_payment_ratio") }},
-- GUEST REVENUE --
{{ calculate_safe_relative_increment("deposit_fees_in_gbp") }},
@ -571,9 +607,11 @@ select
-- INCOME RETAINED --
{{ calculate_safe_relative_increment("revenue_retained_in_gbp") }},
{{ calculate_safe_relative_increment("revenue_retained_ratio") }},
-- INCOME RETAINED POST RESOLUTIONS--
{{ calculate_safe_relative_increment("revenue_retained_post_resolutions_in_gbp") }},
{{ calculate_safe_relative_increment("revenue_retained_post_resolutions_ratio") }},
-- ONBOARDING MRR METRIC --
{{ calculate_safe_relative_increment("expected_mrr") }}