Merged PR 3469: Switches Listing and Deal metrics
# Description Switches Listings and Deal metrics to production. I also modified the dependencies on the old lifecycles to read from the news, so we can remove these in a following PR. I'm considering re-computing also the dimension - specific models to operate within KPIs folder, but will do this later on in a dedicated PR. # 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. - [ ] 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: #23761
This commit is contained in:
parent
335ba9a29b
commit
5e1b418570
4 changed files with 63 additions and 49 deletions
|
|
@ -108,10 +108,22 @@ with
|
|||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
int_core__mtd_accommodation_metrics as (
|
||||
select * from {{ ref("int_core__mtd_accommodation_metrics") }}
|
||||
listings as (
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_daily_listings") }}
|
||||
where
|
||||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
and (is_month_to_date = true or is_end_of_month = true)
|
||||
),
|
||||
deals as (
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_daily_deals") }}
|
||||
where
|
||||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
and (is_month_to_date = true or is_end_of_month = true)
|
||||
),
|
||||
int_mtd_deal_metrics as (select * from {{ ref("int_mtd_deal_metrics") }}),
|
||||
guest_payments as (
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_mtd_guest_payments") }}
|
||||
|
|
@ -207,16 +219,16 @@ with
|
|||
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,
|
||||
accommodations.listings_booked_in_12_months,
|
||||
listings.new_listings,
|
||||
listings.never_booked_listings,
|
||||
listings.first_time_booked_listings,
|
||||
listings.active_listings,
|
||||
listings.churning_listings,
|
||||
listings.inactive_listings,
|
||||
listings.reactivated_listings,
|
||||
listings.listings_booked_in_month,
|
||||
listings.listings_booked_in_6_months,
|
||||
listings.listings_booked_in_12_months,
|
||||
|
||||
-- HOST (OPERATOR) REVENUE --
|
||||
invoiced_revenue.xero_booking_net_fees_in_gbp,
|
||||
|
|
@ -288,7 +300,7 @@ with
|
|||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
) / nullif(
|
||||
accommodations.listings_booked_in_month, 0
|
||||
listings.listings_booked_in_month, 0
|
||||
) as total_revenue_per_listings_booked_in_month,
|
||||
|
||||
-- CHURN --
|
||||
|
|
@ -338,12 +350,12 @@ with
|
|||
and d.dimension = guest_journeys_with_payment.dimension
|
||||
and d.dimension_value = guest_journeys_with_payment.dimension_value
|
||||
left join
|
||||
int_core__mtd_accommodation_metrics accommodations
|
||||
on d.date = accommodations.date
|
||||
and d.dimension = accommodations.dimension
|
||||
and d.dimension_value = accommodations.dimension_value
|
||||
listings
|
||||
on d.date = listings.date
|
||||
and d.dimension = listings.dimension
|
||||
and d.dimension_value = listings.dimension_value
|
||||
left join
|
||||
int_mtd_deal_metrics deals
|
||||
deals
|
||||
on d.date = deals.date
|
||||
and d.dimension = deals.dimension
|
||||
and d.dimension_value = deals.dimension_value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue