Merged PR 2422: Ensure that guest payments models follow nomenclature
Small refactor to follow up on last week's PR. We removed from the Guest Revenue models the host-takes-waiver aspect, thus these models are now only depending from Core. We just need to migrate it from cross to core. One small detail as well, since we do not take into account at these models level the host-takes-waiver, technically, I would not call these models revenue but rather Guest Payments. This is why I also took the opportunity to apply this name. Changes: - `int_monthly_guest_revenue_by_deal` is now `int_core__monthly_guest_payments_history_by_deal`, and the location has changed from `intermediate.cross` to `intermediate.core` - `int_mtd_guest_revenue_metrics` is now `int_core__mtd_guest_payments_metrics`, and the location has changed from `intermediate.cross` to `intermediate.core` - Schema changes, moving these 2 models' documentation with the new naming from Cross to Core - Provide continuity in following dependants: `int_mtd_vs_previous_year_metrics` and `int_monthly_aggregated_metrics_history_by_deal` now read from the 2 new models respectively. Additionally, the model alias has changed from `guest_revenue` to `guest_payments` to keep consistency. This PR does not expose new metrics, but should keep the existing ones unaffected. Related work items: #18914
This commit is contained in:
parent
04eb09c318
commit
1b1b97380a
6 changed files with 75 additions and 75 deletions
|
|
@ -16,8 +16,8 @@ with
|
|||
int_core__mtd_deal_metrics as (
|
||||
select * from {{ ref("int_core__mtd_deal_metrics") }}
|
||||
),
|
||||
int_mtd_guest_revenue_metrics as (
|
||||
select * from {{ ref("int_mtd_guest_revenue_metrics") }}
|
||||
int_core__mtd_guest_payments_metrics as (
|
||||
select * from {{ ref("int_core__mtd_guest_payments_metrics") }}
|
||||
),
|
||||
int_xero__mtd_invoicing_metrics as (
|
||||
select * from {{ ref("int_xero__mtd_invoicing_metrics") }}
|
||||
|
|
@ -92,20 +92,20 @@ with
|
|||
invoicing.xero_host_resolution_payment_count,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
guest_revenue.deposit_fees_in_gbp,
|
||||
guest_revenue.waiver_payments_in_gbp,
|
||||
guest_revenue.checkin_cover_fees_in_gbp,
|
||||
guest_revenue.total_guest_payments_in_gbp,
|
||||
guest_revenue.total_guest_income_in_gbp,
|
||||
guest_payments.deposit_fees_in_gbp,
|
||||
guest_payments.waiver_payments_in_gbp,
|
||||
guest_payments.checkin_cover_fees_in_gbp,
|
||||
guest_payments.total_guest_payments_in_gbp,
|
||||
guest_payments.total_guest_income_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0),
|
||||
0
|
||||
) as total_guest_revenue_in_gbp,
|
||||
|
||||
-- TOTAL REVENUE --
|
||||
nullif(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0),
|
||||
|
|
@ -113,21 +113,21 @@ with
|
|||
) as total_revenue_in_gbp,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS WEIGHTED METRICS --
|
||||
guest_revenue.total_guest_payments_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_journeys.completed_guest_journeys, 0
|
||||
) as guest_payments_per_completed_guest_journey,
|
||||
guest_revenue.total_guest_payments_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_journeys.paid_guest_journeys, 0
|
||||
) as guest_payments_per_paid_guest_journey,
|
||||
nullif(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
guest_journeys.completed_guest_journeys, 0
|
||||
) as guest_revenue_per_completed_guest_journey,
|
||||
nullif(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
|
|
@ -136,14 +136,14 @@ with
|
|||
|
||||
-- TOTAL REVENUE WEIGHTED METRICS --
|
||||
(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
)
|
||||
/ nullif(bookings.created_bookings, 0) as total_revenue_per_created_booking,
|
||||
(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -151,7 +151,7 @@ with
|
|||
guest_journeys.created_guest_journeys, 0
|
||||
) as total_revenue_per_created_guest_journey,
|
||||
(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -159,7 +159,7 @@ with
|
|||
deals.deals_booked_in_month, 0
|
||||
) as total_revenue_per_deals_booked_in_month,
|
||||
(
|
||||
coalesce(guest_revenue.total_guest_income_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_income_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -177,7 +177,7 @@ with
|
|||
on d.date = accommodations.date
|
||||
left join int_core__mtd_deal_metrics deals on d.date = deals.date
|
||||
left join
|
||||
int_mtd_guest_revenue_metrics guest_revenue on d.date = guest_revenue.date
|
||||
int_core__mtd_guest_payments_metrics guest_payments on d.date = guest_payments.date
|
||||
left join int_xero__mtd_invoicing_metrics invoicing on d.date = invoicing.date
|
||||
)
|
||||
select
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue