From 49a10fe249295940c6e40768986079bf5de58d59 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Thu, 23 Jan 2025 17:14:36 +0100 Subject: [PATCH 1/2] New KPI rates for Main KPIs --- .../cross/int_mtd_aggregated_metrics.sql | 42 +++++++++++++++++-- .../int_mtd_vs_previous_year_metrics.sql | 38 +++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/models/intermediate/cross/int_mtd_aggregated_metrics.sql b/models/intermediate/cross/int_mtd_aggregated_metrics.sql index d8809f0..6adfa44 100644 --- a/models/intermediate/cross/int_mtd_aggregated_metrics.sql +++ b/models/intermediate/cross/int_mtd_aggregated_metrics.sql @@ -190,6 +190,33 @@ }, { "order_by": 100, + "metric": "Revenue Retained Rate", + "value": "revenue_retained_ratio", + "previous_year_value": "previous_year_revenue_retained_ratio", + "relative_increment": "relative_increment_revenue_retained_ratio", + "number_format": "percentage", + "increment_sign_format": "positive", + }, + { + "order_by": 101, + "metric": "Revenue Retained Post-Resolutions Rate", + "value": "revenue_retained_post_resolutions_ratio", + "previous_year_value": "previous_year_revenue_retained_post_resolutions_ratio", + "relative_increment": "relative_increment_revenue_retained_post_resolutions_ratio", + "number_format": "percentage", + "increment_sign_format": "positive", + }, + { + "order_by": 102, + "metric": "Host Resolution Payment Rate", + "value": "xero_host_resolution_payment_ratio", + "previous_year_value": "previous_year_xero_host_resolution_payment_ratio", + "relative_increment": "relative_increment_xero_host_resolution_payment_ratio", + "number_format": "percentage", + "increment_sign_format": "negative", + }, + { + "order_by": 110, "metric": "Guest Journey Start Rate", "value": "start_rate_guest_journey", "previous_year_value": "previous_year_start_rate_guest_journey", @@ -198,7 +225,7 @@ "increment_sign_format": "positive", }, { - "order_by": 101, + "order_by": 111, "metric": "Guest Journey Completion Rate", "value": "completion_rate_guest_journey", "previous_year_value": "previous_year_completion_rate_guest_journey", @@ -207,7 +234,7 @@ "increment_sign_format": "positive", }, { - "order_by": 102, + "order_by": 112, "metric": "Guest Journey Incompletion Rate", "value": "incompletion_rate_guest_journey", "previous_year_value": "previous_year_incompletion_rate_guest_journey", @@ -216,7 +243,7 @@ "increment_sign_format": "negative", }, { - "order_by": 103, + "order_by": 113, "metric": "Guest Journey Payment Rate", "value": "payment_rate_guest_journey", "previous_year_value": "previous_year_payment_rate_guest_journey", @@ -530,6 +557,15 @@ "number_format": "currency_gbp", "increment_sign_format": "negative", }, + { + "order_by": 271, + "metric": "Host Resolutions Amount Paid per Booking", + "value": "xero_host_resolution_payment_per_booking_in_gbp", + "previous_year_value": "previous_year_xero_host_resolution_payment_per_booking_in_gbp", + "relative_increment": "relative_increment_xero_host_resolution_payment_per_booking_in_gbp", + "number_format": "currency_gbp", + "increment_sign_format": "negative", + }, ] %} with int_mtd_vs_previous_year_metrics as ( diff --git a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql index 84cc2da..14bb950 100644 --- a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql +++ b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql @@ -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") }} From f7bacc2310999c132906bf50c49180ff574fbab8 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Fri, 24 Jan 2025 08:30:05 +0100 Subject: [PATCH 2/2] changed names --- .../cross/int_mtd_aggregated_metrics.sql | 16 ++++++++-------- .../cross/int_mtd_vs_previous_year_metrics.sql | 13 +++++++++---- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/models/intermediate/cross/int_mtd_aggregated_metrics.sql b/models/intermediate/cross/int_mtd_aggregated_metrics.sql index 6adfa44..3fbc1d4 100644 --- a/models/intermediate/cross/int_mtd_aggregated_metrics.sql +++ b/models/intermediate/cross/int_mtd_aggregated_metrics.sql @@ -208,10 +208,10 @@ }, { "order_by": 102, - "metric": "Host Resolution Payment Rate", - "value": "xero_host_resolution_payment_ratio", - "previous_year_value": "previous_year_xero_host_resolution_payment_ratio", - "relative_increment": "relative_increment_xero_host_resolution_payment_ratio", + "metric": "Host Resolutions Payment Rate", + "value": "host_resolution_payment_per_created_booking_ratio", + "previous_year_value": "previous_year_host_resolution_payment_per_created_booking_ratio", + "relative_increment": "relative_increment_host_resolution_payment_per_created_booking_ratio", "number_format": "percentage", "increment_sign_format": "negative", }, @@ -559,10 +559,10 @@ }, { "order_by": 271, - "metric": "Host Resolutions Amount Paid per Booking", - "value": "xero_host_resolution_payment_per_booking_in_gbp", - "previous_year_value": "previous_year_xero_host_resolution_payment_per_booking_in_gbp", - "relative_increment": "relative_increment_xero_host_resolution_payment_per_booking_in_gbp", + "metric": "Host Resolutions Amount Paid per Booking Created", + "value": "host_resolution_amount_paid_per_created_booking", + "previous_year_value": "previous_year_host_resolution_amount_paid_per_created_booking", + "relative_increment": "relative_increment_host_resolution_amount_paid_per_created_booking", "number_format": "currency_gbp", "increment_sign_format": "negative", }, diff --git a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql index 14bb950..bc45c22 100644 --- a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql +++ b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql @@ -288,9 +288,10 @@ with 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, + as host_resolution_amount_paid_per_created_booking, cast(host_resolutions.xero_host_resolution_payment_count as decimal) - / created_bookings.created_bookings as xero_host_resolution_payment_ratio, + / created_bookings.created_bookings + as host_resolution_payment_per_created_booking_ratio, -- GUEST REVENUE AND PAYMENTS -- guest_payments.deposit_fees_in_gbp, @@ -558,10 +559,14 @@ select {{ calculate_safe_relative_increment("xero_host_resolution_payment_count") }}, {{ calculate_safe_relative_increment( - "xero_host_resolution_payment_per_booking_in_gbp" + "host_resolution_amount_paid_per_created_booking" + ) + }}, + {{ + calculate_safe_relative_increment( + "host_resolution_payment_per_created_booking_ratio" ) }}, - {{ calculate_safe_relative_increment("xero_host_resolution_payment_ratio") }}, -- GUEST REVENUE -- {{ calculate_safe_relative_increment("deposit_fees_in_gbp") }},