2024-07-08 15:58:36 +00:00
|
|
|
/*
|
|
|
|
|
This model pivots the data of the different mtd metrics models to get
|
|
|
|
|
previous year for each line & computing relative increment. --
|
|
|
|
|
*/
|
|
|
|
|
{{ config(materialized="table", unique_key="date") }}
|
|
|
|
|
with
|
|
|
|
|
int_core__mtd_booking_metrics as (
|
|
|
|
|
select * from {{ ref("int_core__mtd_booking_metrics") }}
|
Merged PR 2519: mtd bookings with 2 dimensions
# Description
This is a first idea of how I'd like to add dimensionality in the KPIs for the mtd models. For the moment, I keep deal_id apart, so I just touch the "mtd" models, that so far only contained "global" metrics.
In this case I include the listing segmentation (0, 1-5, 6-20, etc) in the bookings. To do this, I created 2 new fields: dimension and dimension_values.
I also created a "master" table with `date` - `dimension` - `dimension_value` called `int_dates_mtd_by_dimension`
Important notes:
- I force a hardcode in `int_mtd_vs_previous_year_metrics`. This is to not break production.
- You will notice how repetitive the code is starting to look. My intention with this PR is that we are happy with this approach on the naming, the strategy for joins, etc. If that's ok, next step is going to be doing macros on top. Think of the state of `int_core__mtd_booking_metrics` as the "compiled version" of the macro that should come afterwards.
# 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.
- [ ] 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: #19325
2024-08-08 09:11:01 +00:00
|
|
|
-- TEMPORAL: FORCING DIMENSION = GLOBAL TO AVOID BREAKING CHANGES IN PRODUCTION
|
|
|
|
|
where dimension = 'global'
|
2024-07-08 15:58:36 +00:00
|
|
|
),
|
2024-07-09 13:00:43 +00:00
|
|
|
int_core__mtd_guest_journey_metrics as (
|
|
|
|
|
select * from {{ ref("int_core__mtd_guest_journey_metrics") }}
|
|
|
|
|
),
|
|
|
|
|
int_core__mtd_accommodation_metrics as (
|
|
|
|
|
select * from {{ ref("int_core__mtd_accommodation_metrics") }}
|
|
|
|
|
),
|
|
|
|
|
int_core__mtd_deal_metrics as (
|
|
|
|
|
select * from {{ ref("int_core__mtd_deal_metrics") }}
|
|
|
|
|
),
|
2024-07-29 09:10:58 +00:00
|
|
|
int_core__mtd_guest_payments_metrics as (
|
|
|
|
|
select * from {{ ref("int_core__mtd_guest_payments_metrics") }}
|
2024-07-10 08:52:19 +00:00
|
|
|
),
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
int_xero__mtd_invoicing_metrics as (
|
2024-07-19 07:30:42 +00:00
|
|
|
select * from {{ ref("int_xero__mtd_invoicing_metrics") }}
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
),
|
2024-07-08 15:58:36 +00:00
|
|
|
int_dates_mtd as (select * from {{ ref("int_dates_mtd") }}),
|
|
|
|
|
|
|
|
|
|
plain_kpi_combination as (
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
|
2024-07-08 15:58:36 +00:00
|
|
|
select
|
|
|
|
|
d.year,
|
|
|
|
|
d.month,
|
|
|
|
|
d.day,
|
|
|
|
|
d.is_end_of_month,
|
|
|
|
|
d.is_current_month,
|
2024-07-16 09:14:38 +00:00
|
|
|
d.first_day_month,
|
2024-07-08 15:58:36 +00:00
|
|
|
d.date,
|
2024-07-09 13:00:43 +00:00
|
|
|
|
|
|
|
|
-- BOOKINGS --
|
2024-07-08 15:58:36 +00:00
|
|
|
bookings.created_bookings,
|
|
|
|
|
bookings.check_out_bookings,
|
2024-07-09 13:00:43 +00:00
|
|
|
bookings.cancelled_bookings,
|
2024-07-15 12:32:18 +00:00
|
|
|
bookings.billable_bookings,
|
2024-07-09 13:00:43 +00:00
|
|
|
|
|
|
|
|
-- GUEST JOURNEYS --
|
|
|
|
|
guest_journeys.created_guest_journeys,
|
|
|
|
|
guest_journeys.started_guest_journeys,
|
|
|
|
|
guest_journeys.completed_guest_journeys,
|
|
|
|
|
guest_journeys.paid_guest_journeys,
|
|
|
|
|
guest_journeys.start_rate_guest_journey,
|
|
|
|
|
guest_journeys.completion_rate_guest_journey,
|
|
|
|
|
guest_journeys.incompletion_rate_guest_journey,
|
|
|
|
|
guest_journeys.payment_rate_guest_journey,
|
|
|
|
|
|
|
|
|
|
-- DEALS --
|
|
|
|
|
deals.new_deals,
|
|
|
|
|
deals.never_booked_deals,
|
|
|
|
|
deals.first_time_booked_deals,
|
|
|
|
|
deals.active_deals,
|
|
|
|
|
deals.churning_deals,
|
|
|
|
|
deals.inactive_deals,
|
|
|
|
|
deals.reactivated_deals,
|
|
|
|
|
deals.deals_booked_in_month,
|
|
|
|
|
deals.deals_booked_in_6_months,
|
|
|
|
|
deals.deals_booked_in_12_months,
|
|
|
|
|
|
|
|
|
|
-- LISTINGS (ACCOMMODATIONS) --
|
|
|
|
|
accommodations.new_listings,
|
|
|
|
|
accommodations.never_booked_listings,
|
|
|
|
|
accommodations.first_time_booked_listings,
|
|
|
|
|
accommodations.active_listings,
|
|
|
|
|
accommodations.churning_listings,
|
|
|
|
|
accommodations.inactive_listings,
|
|
|
|
|
accommodations.reactivated_listings,
|
|
|
|
|
accommodations.listings_booked_in_month,
|
|
|
|
|
accommodations.listings_booked_in_6_months,
|
2024-07-10 08:52:19 +00:00
|
|
|
accommodations.listings_booked_in_12_months,
|
|
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- HOST (OPERATOR) REVENUE --
|
|
|
|
|
invoicing.xero_booking_net_fees_in_gbp,
|
|
|
|
|
invoicing.xero_listing_net_fees_in_gbp,
|
|
|
|
|
invoicing.xero_verification_net_fees_in_gbp,
|
|
|
|
|
invoicing.xero_operator_net_fees_in_gbp,
|
|
|
|
|
|
2024-07-19 07:30:42 +00:00
|
|
|
-- APIs REVENUE --
|
|
|
|
|
invoicing.xero_apis_net_fees_in_gbp,
|
|
|
|
|
invoicing.xero_e_deposit_net_fees_in_gbp,
|
|
|
|
|
invoicing.xero_guesty_net_fees_in_gbp,
|
|
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- HOST RESOLUTIONS --
|
|
|
|
|
invoicing.xero_host_resolution_amount_paid_in_gbp,
|
|
|
|
|
invoicing.xero_host_resolution_payment_count,
|
|
|
|
|
|
2024-07-10 08:52:19 +00:00
|
|
|
-- GUEST REVENUE AND PAYMENTS --
|
2024-07-29 09:10:58 +00:00
|
|
|
guest_payments.deposit_fees_in_gbp,
|
|
|
|
|
guest_payments.waiver_payments_in_gbp,
|
2024-07-29 13:16:19 +00:00
|
|
|
invoicing.xero_waiver_paid_back_to_host_in_gbp,
|
|
|
|
|
nullif(
|
|
|
|
|
coalesce(guest_payments.waiver_payments_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
|
|
|
|
0
|
|
|
|
|
) as waiver_net_fees_in_gbp,
|
2024-07-29 09:10:58 +00:00
|
|
|
guest_payments.checkin_cover_fees_in_gbp,
|
|
|
|
|
guest_payments.total_guest_payments_in_gbp,
|
2024-07-23 13:50:03 +00:00
|
|
|
nullif(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
2024-07-23 13:50:03 +00:00
|
|
|
0
|
|
|
|
|
) as total_guest_revenue_in_gbp,
|
2024-07-10 08:52:19 +00:00
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- TOTAL REVENUE --
|
2024-07-19 09:14:30 +00:00
|
|
|
nullif(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
2024-07-19 09:14:30 +00:00
|
|
|
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0),
|
|
|
|
|
0
|
|
|
|
|
) as total_revenue_in_gbp,
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
|
|
|
|
|
-- GUEST REVENUE AND PAYMENTS WEIGHTED METRICS --
|
2024-07-29 09:10:58 +00:00
|
|
|
guest_payments.total_guest_payments_in_gbp / nullif(
|
2024-07-10 08:52:19 +00:00
|
|
|
guest_journeys.completed_guest_journeys, 0
|
|
|
|
|
) as guest_payments_per_completed_guest_journey,
|
2024-07-29 09:10:58 +00:00
|
|
|
guest_payments.total_guest_payments_in_gbp / nullif(
|
2024-07-10 08:52:19 +00:00
|
|
|
guest_journeys.paid_guest_journeys, 0
|
|
|
|
|
) as guest_payments_per_paid_guest_journey,
|
2024-07-23 13:50:03 +00:00
|
|
|
nullif(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
2024-07-23 13:50:03 +00:00
|
|
|
0
|
|
|
|
|
) / nullif(
|
2024-07-10 08:52:19 +00:00
|
|
|
guest_journeys.completed_guest_journeys, 0
|
|
|
|
|
) as guest_revenue_per_completed_guest_journey,
|
2024-07-23 13:50:03 +00:00
|
|
|
nullif(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
2024-07-23 13:50:03 +00:00
|
|
|
0
|
|
|
|
|
) / nullif(
|
2024-07-10 08:52:19 +00:00
|
|
|
guest_journeys.paid_guest_journeys, 0
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
) as guest_revenue_per_paid_guest_journey,
|
|
|
|
|
|
|
|
|
|
-- TOTAL REVENUE WEIGHTED METRICS --
|
2024-07-19 07:30:42 +00:00
|
|
|
(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
2024-07-19 09:14:30 +00:00
|
|
|
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
2024-07-19 07:30:42 +00:00
|
|
|
)
|
|
|
|
|
/ nullif(bookings.created_bookings, 0) as total_revenue_per_created_booking,
|
|
|
|
|
(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
2024-07-19 09:14:30 +00:00
|
|
|
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
2024-07-19 07:30:42 +00:00
|
|
|
) / nullif(
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
guest_journeys.created_guest_journeys, 0
|
|
|
|
|
) as total_revenue_per_created_guest_journey,
|
2024-07-19 07:30:42 +00:00
|
|
|
(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
2024-07-19 09:14:30 +00:00
|
|
|
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
2024-07-19 07:30:42 +00:00
|
|
|
) / nullif(
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
deals.deals_booked_in_month, 0
|
|
|
|
|
) as total_revenue_per_deals_booked_in_month,
|
2024-07-19 07:30:42 +00:00
|
|
|
(
|
2024-07-29 15:15:09 +00:00
|
|
|
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
2024-07-29 13:16:19 +00:00
|
|
|
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
2024-07-19 09:14:30 +00:00
|
|
|
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
|
|
|
|
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
2024-07-19 07:30:42 +00:00
|
|
|
) / nullif(
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
accommodations.listings_booked_in_month, 0
|
|
|
|
|
) as total_revenue_per_listings_booked_in_month
|
2024-07-09 13:00:43 +00:00
|
|
|
|
2024-07-08 15:58:36 +00:00
|
|
|
from int_dates_mtd d
|
2024-07-19 07:30:42 +00:00
|
|
|
left join int_core__mtd_booking_metrics bookings on d.date = bookings.date
|
|
|
|
|
left join
|
|
|
|
|
int_core__mtd_guest_journey_metrics guest_journeys
|
2024-07-09 13:00:43 +00:00
|
|
|
on d.date = guest_journeys.date
|
2024-07-19 07:30:42 +00:00
|
|
|
left join
|
|
|
|
|
int_core__mtd_accommodation_metrics accommodations
|
2024-07-09 13:00:43 +00:00
|
|
|
on d.date = accommodations.date
|
2024-07-19 07:30:42 +00:00
|
|
|
left join int_core__mtd_deal_metrics deals on d.date = deals.date
|
|
|
|
|
left join
|
2024-07-29 09:10:58 +00:00
|
|
|
int_core__mtd_guest_payments_metrics guest_payments on d.date = guest_payments.date
|
2024-07-19 07:30:42 +00:00
|
|
|
left join int_xero__mtd_invoicing_metrics invoicing on d.date = invoicing.date
|
2024-07-08 15:58:36 +00:00
|
|
|
)
|
|
|
|
|
select
|
|
|
|
|
current.year,
|
|
|
|
|
current.month,
|
|
|
|
|
current.day,
|
|
|
|
|
current.is_end_of_month,
|
|
|
|
|
current.is_current_month,
|
2024-07-16 09:14:38 +00:00
|
|
|
current.first_day_month,
|
2024-07-08 15:58:36 +00:00
|
|
|
current.date,
|
|
|
|
|
previous_year.date as previous_year_date,
|
|
|
|
|
|
|
|
|
|
-- BOOKINGS --
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("created_bookings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("check_out_bookings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("cancelled_bookings") }},
|
2024-07-15 12:32:18 +00:00
|
|
|
{{ calculate_safe_relative_increment("billable_bookings") }},
|
2024-07-09 13:00:43 +00:00
|
|
|
|
|
|
|
|
-- GUEST JOURNEYS --
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("created_guest_journeys") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("started_guest_journeys") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("completed_guest_journeys") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("paid_guest_journeys") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("start_rate_guest_journey") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("completion_rate_guest_journey") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("incompletion_rate_guest_journey") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("payment_rate_guest_journey") }},
|
2024-07-09 13:00:43 +00:00
|
|
|
|
|
|
|
|
-- DEALS --
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("new_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("never_booked_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("first_time_booked_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("active_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("churning_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("inactive_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("reactivated_deals") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("deals_booked_in_month") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("deals_booked_in_6_months") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("deals_booked_in_12_months") }},
|
2024-07-09 13:00:43 +00:00
|
|
|
|
|
|
|
|
-- LISTINGS --
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("new_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("never_booked_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("first_time_booked_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("active_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("churning_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("inactive_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("reactivated_listings") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("listings_booked_in_month") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("listings_booked_in_6_months") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("listings_booked_in_12_months") }},
|
|
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- HOST (OPERATOR) REVENUE --
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_booking_net_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_listing_net_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_verification_net_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_operator_net_fees_in_gbp") }},
|
|
|
|
|
|
2024-07-19 07:30:42 +00:00
|
|
|
-- APIs REVENUE --
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_apis_net_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_e_deposit_net_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_guesty_net_fees_in_gbp") }},
|
|
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- HOST RESOLUTIONS --
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_host_resolution_amount_paid_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("xero_host_resolution_payment_count") }},
|
|
|
|
|
|
2024-07-10 08:52:19 +00:00
|
|
|
-- GUEST REVENUE AND PAYMENTS --
|
2024-07-23 13:50:03 +00:00
|
|
|
{{ calculate_safe_relative_increment("deposit_fees_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("waiver_payments_in_gbp") }},
|
2024-07-29 13:16:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("xero_waiver_paid_back_to_host_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("waiver_net_fees_in_gbp") }},
|
2024-07-23 13:50:03 +00:00
|
|
|
{{ calculate_safe_relative_increment("checkin_cover_fees_in_gbp") }},
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("total_guest_payments_in_gbp") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("total_guest_revenue_in_gbp") }},
|
|
|
|
|
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
-- TOTAL REVENUE --
|
|
|
|
|
{{ calculate_safe_relative_increment("total_revenue_in_gbp") }},
|
|
|
|
|
|
|
|
|
|
-- GUEST REVENUE AND PAYMENTS WEIGHTED METRICS --
|
2024-07-19 07:30:42 +00:00
|
|
|
{{
|
|
|
|
|
calculate_safe_relative_increment(
|
|
|
|
|
"guest_payments_per_completed_guest_journey"
|
|
|
|
|
)
|
|
|
|
|
}},
|
2024-07-10 08:52:19 +00:00
|
|
|
{{ calculate_safe_relative_increment("guest_payments_per_paid_guest_journey") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("guest_revenue_per_completed_guest_journey") }},
|
Merged PR 2292: Propagate invoicing metrics for KPIs
This PR aims to propagate the invoicing metrics through the DWH. It does not expose them to users, yet.
This PR effectively computes the following metrics, for both the "global" view (MTD) and the "by deal" view (by_deal):
- Invoiced Operator Revenue
- Host Resolution Count of Payments
- Host Resolution Amount Paid
With these 3 new metrics, we're able to combine them with the existing ones to compute:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deal Booked in Month
- Total Revenue per Listings Booked in Month
You'll also note that I've included standalone metrics for booking fees, listing fees, verification fees and waiver payments. This will not be exposed in this batch 2, but based on the conversation with Finance, will clearly make it for batch 3. I just find it easier to add it now, since it's straight forward.
Main changes:
- `int_mtd_vs_previous_year_metrics` now computes all the above mentioned metrics
- `int_monthly_aggregated_metrics_history_by_deal` now computes all the above mentioned metrics, except Total Revenue per Deal Booked in Month since it does not make sense for the deal view. Additionally, I took the opportunity to include the missing metrics from listings (accommodations). The goal is not necessarily to display them, but at least compute it on our side.
Additional changes:
- In `int_xero__mtd_invoicing_metrics` and `int_xero__monthly_invoicing_history_by_deal`, there's a very silly name change to keep the same convention for fees: from `xero_operator_net_fees` to `xero_operator_net_fees_in_gbp`
- I applied additional changes in `int_monthly_aggregated_metrics_history_by_deal` with the goal to keep the same format as we have in `int_mtd_vs_previous_year_metrics`, this meaning:
1 - explicit alias naming (from `gj` to `guest_journeys`)
2 - keep a similar arrangement of metrics, and clearly separate scopes depending on the metric type
3 - Re-apply autoformatting
Related work items: #18108, #18109, #18110
2024-07-15 07:33:55 +00:00
|
|
|
{{ calculate_safe_relative_increment("guest_revenue_per_paid_guest_journey") }},
|
|
|
|
|
|
|
|
|
|
-- TOTAL REVENUE WEIGHTED METRICS --
|
2024-07-19 07:30:42 +00:00
|
|
|
{{ calculate_safe_relative_increment("total_revenue_per_created_booking") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("total_revenue_per_created_guest_journey") }},
|
|
|
|
|
{{ calculate_safe_relative_increment("total_revenue_per_deals_booked_in_month") }},
|
|
|
|
|
{{
|
|
|
|
|
calculate_safe_relative_increment(
|
|
|
|
|
"total_revenue_per_listings_booked_in_month"
|
|
|
|
|
)
|
|
|
|
|
}}
|
2024-07-08 15:58:36 +00:00
|
|
|
|
|
|
|
|
from plain_kpi_combination current
|
2024-07-10 08:52:19 +00:00
|
|
|
left join
|
|
|
|
|
plain_kpi_combination previous_year
|
2024-07-08 15:58:36 +00:00
|
|
|
on current.month = previous_year.month
|
|
|
|
|
and current.year = previous_year.year + 1
|
|
|
|
|
where
|
|
|
|
|
(
|
|
|
|
|
current.is_end_of_month = 1
|
|
|
|
|
or (current.is_current_month = 1 and current.day = previous_year.day)
|
|
|
|
|
)
|