Merged PR 2257: Expose guest revenue and guest journey payment metrics

This PR aims to expose the new metrics to the business KPIs report.
The new metrics exposed are, for the global and the by deal view:
- Guest Revenue
- Guest Revenue per Guest Journey Completed
- Guest Revenue per Guest Journey with Payment
- Guest Payments
- Guest Payments per Guest Journey Completed
- Guest Payments per Guest Journey with Payment
- Guest Journey with Payment
- Guest Journey Payment Rate

Changes:
- Silly change on the naming in the by deal view of `payment_rate_guest_journey` to be consistent with the global view.
- Silly change that I miss some GJ payment metric for the view by deal id.
- Added a new number format called `currency_gbp` - only for monetary metrics, available in the schema files
- Usual procedure to publish metrics: for global metrics, add them in the `int_mtd_aggregated_metrics`. I also changed the order of display.
- **Important**: to avoid displaying revenue figures until Xero invoicing is handled, I created a macro called `is_date_before_previous_month` that is called in the reporting equivalent models: `mtd_aggregated_metrics` in the where section and in the `monthly_aggregated_metrics_history_by_deal` as a case-when.

This should allow to expose all new metrics, and enable the publishing of a new update of the business kpis!

Related work items: #18107
This commit is contained in:
Oriol Roqué Paniagua 2024-07-10 14:17:05 +00:00
parent d39bc02ae1
commit 3b75d9eefb
8 changed files with 171 additions and 39 deletions

View file

@ -81,7 +81,7 @@ with
cast(sym.started_guest_journeys as decimal)/cym.created_guest_journeys as start_rate_guest_journey,
cast(coym.completed_guest_journeys as decimal)/sym.started_guest_journeys as completion_rate_guest_journey,
1-cast(coym.completed_guest_journeys as decimal)/sym.started_guest_journeys as incompletion_rate_guest_journey,
cast(pym.paid_guest_journeys as decimal)/coym.completed_guest_journeys as paid_rate_guest_journey
cast(pym.paid_guest_journeys as decimal)/coym.completed_guest_journeys as payment_rate_guest_journey
from int_dates_by_deal d
left join created_year_month cym
on d.first_day_month = cym.first_day_month

View file

@ -24,10 +24,11 @@ select
gj.created_guest_journeys,
gj.started_guest_journeys,
gj.completed_guest_journeys,
gj.paid_guest_journeys,
gj.start_rate_guest_journey,
gj.completion_rate_guest_journey,
gj.incompletion_rate_guest_journey,
gj.paid_guest_journeys,
gj.payment_rate_guest_journey,
a.new_listings,
a.first_time_booked_listings,
a.churning_listings,

View file

@ -49,6 +49,14 @@
},
{
"order_by": 7,
"metric": "Guest Journey with Payment",
"value": "paid_guest_journeys",
"previous_year_value": "previous_year_paid_guest_journeys",
"relative_increment": "relative_increment_paid_guest_journeys",
"number_format": "integer",
},
{
"order_by": 8,
"metric": "New Deals",
"value": "new_deals",
"previous_year_value": "previous_year_new_deals",
@ -56,7 +64,7 @@
"number_format": "integer",
},
{
"order_by": 8,
"order_by": 9,
"metric": "First Time Booked Deals",
"value": "first_time_booked_deals",
"previous_year_value": "previous_year_first_time_booked_deals",
@ -64,7 +72,7 @@
"number_format": "integer",
},
{
"order_by": 9,
"order_by": 10,
"metric": "Deals Booked in Month",
"value": "deals_booked_in_month",
"previous_year_value": "previous_year_deals_booked_in_month",
@ -72,7 +80,7 @@
"number_format": "integer",
},
{
"order_by": 10,
"order_by": 11,
"metric": "Deals Booked in 6 Months",
"value": "deals_booked_in_6_months",
"previous_year_value": "previous_year_deals_booked_in_6_months",
@ -80,7 +88,7 @@
"number_format": "integer",
},
{
"order_by": 11,
"order_by": 12,
"metric": "Deals Booked in 12 Months",
"value": "deals_booked_in_12_months",
"previous_year_value": "previous_year_deals_booked_in_12_months",
@ -88,7 +96,7 @@
"number_format": "integer",
},
{
"order_by": 12,
"order_by": 13,
"metric": "Churning Deals",
"value": "churning_deals",
"previous_year_value": "previous_year_churning_deals",
@ -96,7 +104,7 @@
"number_format": "integer",
},
{
"order_by": 13,
"order_by": 14,
"metric": "New Listings",
"value": "new_listings",
"previous_year_value": "previous_year_new_listings",
@ -104,7 +112,7 @@
"number_format": "integer",
},
{
"order_by": 14,
"order_by": 15,
"metric": "First Time Booked Listings",
"value": "first_time_booked_listings",
"previous_year_value": "previous_year_first_time_booked_listings",
@ -112,7 +120,7 @@
"number_format": "integer",
},
{
"order_by": 15,
"order_by": 16,
"metric": "Listings Booked in Month",
"value": "listings_booked_in_month",
"previous_year_value": "previous_year_listings_booked_in_month",
@ -120,7 +128,7 @@
"number_format": "integer",
},
{
"order_by": 16,
"order_by": 17,
"metric": "Listings Booked in 6 Months",
"value": "listings_booked_in_6_months",
"previous_year_value": "previous_year_listings_booked_in_6_months",
@ -128,7 +136,7 @@
"number_format": "integer",
},
{
"order_by": 17,
"order_by": 18,
"metric": "Listings Booked in 12 Months",
"value": "listings_booked_in_12_months",
"previous_year_value": "previous_year_listings_booked_in_12_months",
@ -136,7 +144,7 @@
"number_format": "integer",
},
{
"order_by": 18,
"order_by": 19,
"metric": "Churning Listings",
"value": "churning_listings",
"previous_year_value": "previous_year_churning_listings",
@ -144,7 +152,7 @@
"number_format": "integer",
},
{
"order_by": 19,
"order_by": 100,
"metric": "Guest Journey Start Rate",
"value": "start_rate_guest_journey",
"previous_year_value": "previous_year_start_rate_guest_journey",
@ -152,7 +160,7 @@
"number_format": "percentage",
},
{
"order_by": 20,
"order_by": 101,
"metric": "Guest Journey Completion Rate",
"value": "completion_rate_guest_journey",
"previous_year_value": "previous_year_completion_rate_guest_journey",
@ -160,13 +168,69 @@
"number_format": "percentage",
},
{
"order_by": 21,
"order_by": 102,
"metric": "Guest Journey Incompletion Rate",
"value": "incompletion_rate_guest_journey",
"previous_year_value": "previous_year_incompletion_rate_guest_journey",
"relative_increment": "relative_increment_incompletion_rate_guest_journey",
"number_format": "percentage",
},
{
"order_by": 103,
"metric": "Guest Journey Payment Rate",
"value": "payment_rate_guest_journey",
"previous_year_value": "previous_year_payment_rate_guest_journey",
"relative_increment": "relative_increment_payment_rate_guest_journey",
"number_format": "percentage",
},
{
"order_by": 200,
"metric": "Guest Payments (GBP)",
"value": "total_guest_payments_in_gbp",
"previous_year_value": "previous_year_total_guest_payments_in_gbp",
"relative_increment": "relative_increment_total_guest_payments_in_gbp",
"number_format": "currency_gbp",
},
{
"order_by": 201,
"metric": "Guest Payments per Guest Journey Completed (GBP)",
"value": "guest_payments_per_completed_guest_journey",
"previous_year_value": "previous_year_guest_payments_per_completed_guest_journey",
"relative_increment": "relative_increment_guest_payments_per_completed_guest_journey",
"number_format": "currency_gbp",
},
{
"order_by": 202,
"metric": "Guest Payments per Guest Journey with Payment (GBP)",
"value": "guest_payments_per_paid_guest_journey",
"previous_year_value": "previous_year_guest_payments_per_paid_guest_journey",
"relative_increment": "relative_increment_guest_payments_per_paid_guest_journey",
"number_format": "currency_gbp",
},
{
"order_by": 203,
"metric": "Guest Revenue (GBP)",
"value": "total_guest_revenue_in_gbp",
"previous_year_value": "previous_year_total_guest_revenue_in_gbp",
"relative_increment": "relative_increment_total_guest_revenue_in_gbp",
"number_format": "currency_gbp",
},
{
"order_by": 204,
"metric": "Guest Revenue per Guest Journey Completed (GBP)",
"value": "guest_revenue_per_completed_guest_journey",
"previous_year_value": "previous_year_guest_revenue_per_completed_guest_journey",
"relative_increment": "relative_increment_guest_revenue_per_completed_guest_journey",
"number_format": "currency_gbp",
},
{
"order_by": 205,
"metric": "Guest Revenue per Guest Journey with Payment (GBP)",
"value": "guest_revenue_per_paid_guest_journey",
"previous_year_value": "previous_year_guest_revenue_per_paid_guest_journey",
"relative_increment": "relative_increment_guest_revenue_per_paid_guest_journey",
"number_format": "currency_gbp",
}
] %}
with
int_mtd_vs_previous_year_metrics as (

View file

@ -267,7 +267,7 @@ models:
description: allows for grouping and formatting for displaying purposes.
tests:
- accepted_values:
values: ['integer', 'percentage']
values: ['integer', 'percentage', 'currency_gbp']
- name: value
data_type: numeric