Added business scope to models
This commit is contained in:
parent
72118389d6
commit
89b3989d19
6 changed files with 82 additions and 24 deletions
|
|
@ -16,6 +16,9 @@ with
|
||||||
int_kpis__dimension_daily_accommodation as (
|
int_kpis__dimension_daily_accommodation as (
|
||||||
select * from {{ ref("int_kpis__dimension_daily_accommodation") }}
|
select * from {{ ref("int_kpis__dimension_daily_accommodation") }}
|
||||||
),
|
),
|
||||||
|
int_core__new_dash_deal_since_date as (
|
||||||
|
select * from {{ ref("int_core__new_dash_deal_since_date") }}
|
||||||
|
),
|
||||||
listings as (
|
listings as (
|
||||||
select *
|
select *
|
||||||
from {{ ref("int_kpis__agg_daily_listings") }}
|
from {{ ref("int_kpis__agg_daily_listings") }}
|
||||||
|
|
@ -83,6 +86,20 @@ select
|
||||||
-- DEAL STATIC ATTRIBUTES --
|
-- DEAL STATIC ATTRIBUTES --
|
||||||
ikdd.id_deal,
|
ikdd.id_deal,
|
||||||
ikdd.client_type,
|
ikdd.client_type,
|
||||||
|
case
|
||||||
|
when ikdd.client_type = 'API'
|
||||||
|
then 'API'
|
||||||
|
when ikdd.client_type = 'PLATFORM'
|
||||||
|
then
|
||||||
|
case
|
||||||
|
when
|
||||||
|
icnddsd.id_deal is not null
|
||||||
|
and d.date >= icnddsd.min_user_in_new_dash_since_date_utc
|
||||||
|
then 'New Dash'
|
||||||
|
else 'Old Dash'
|
||||||
|
end
|
||||||
|
else 'UNSET'
|
||||||
|
end as business_scope,
|
||||||
ikdd.main_deal_name,
|
ikdd.main_deal_name,
|
||||||
ikdd.has_active_pms,
|
ikdd.has_active_pms,
|
||||||
ikdd.active_pms_list,
|
ikdd.active_pms_list,
|
||||||
|
|
@ -166,8 +183,7 @@ select
|
||||||
as host_resolution_amount_paid_per_created_booking,
|
as host_resolution_amount_paid_per_created_booking,
|
||||||
{{
|
{{
|
||||||
return_capped_value(
|
return_capped_value(
|
||||||
"cast(host_resolutions.xero_host_resolution_payment_count as decimal)
|
"cast(host_resolutions.xero_host_resolution_payment_count as decimal) / created_bookings.created_bookings",
|
||||||
/ created_bookings.created_bookings",
|
|
||||||
-1,
|
-1,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
@ -234,17 +250,7 @@ select
|
||||||
) as revenue_retained_in_gbp,
|
) as revenue_retained_in_gbp,
|
||||||
{{
|
{{
|
||||||
return_capped_value(
|
return_capped_value(
|
||||||
"nullif(
|
"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)",
|
||||||
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)",
|
|
||||||
-1,
|
-1,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
@ -262,17 +268,7 @@ select
|
||||||
) as revenue_retained_post_resolutions_in_gbp,
|
) as revenue_retained_post_resolutions_in_gbp,
|
||||||
{{
|
{{
|
||||||
return_capped_value(
|
return_capped_value(
|
||||||
"nullif(
|
"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)",
|
||||||
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)",
|
|
||||||
-1,
|
-1,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
@ -331,3 +327,5 @@ left join
|
||||||
host_resolutions
|
host_resolutions
|
||||||
on d.date = host_resolutions.end_date
|
on d.date = host_resolutions.end_date
|
||||||
and d.dimension_value = host_resolutions.dimension_value
|
and d.dimension_value = host_resolutions.dimension_value
|
||||||
|
left join
|
||||||
|
int_core__new_dash_deal_since_date as icnddsd on ikdd.id_deal = icnddsd.id_deal
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -128,6 +129,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -228,6 +230,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -328,6 +331,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -428,6 +432,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -551,6 +556,7 @@ select
|
||||||
|
|
||||||
-- Deal attributes
|
-- Deal attributes
|
||||||
mabd.client_type,
|
mabd.client_type,
|
||||||
|
mabd.business_scope,
|
||||||
mabd.main_deal_name,
|
mabd.main_deal_name,
|
||||||
mabd.has_active_pms,
|
mabd.has_active_pms,
|
||||||
mabd.active_pms_list,
|
mabd.active_pms_list,
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: main_deal_name
|
- name: main_deal_name
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1548,6 +1561,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: metric_from_date
|
- name: metric_from_date
|
||||||
data_type: date
|
data_type: date
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ select
|
||||||
date as date,
|
date as date,
|
||||||
id_deal as id_deal,
|
id_deal as id_deal,
|
||||||
client_type as client_type,
|
client_type as client_type,
|
||||||
|
business_scope as business_scope,
|
||||||
main_deal_name as main_deal_name,
|
main_deal_name as main_deal_name,
|
||||||
main_billing_country_iso_3_per_deal as main_billing_country_iso_3_per_deal,
|
main_billing_country_iso_3_per_deal as main_billing_country_iso_3_per_deal,
|
||||||
deal_lifecycle_state as deal_lifecycle_state,
|
deal_lifecycle_state as deal_lifecycle_state,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ select
|
||||||
main_deal_name as main_deal_name,
|
main_deal_name as main_deal_name,
|
||||||
has_active_pms as has_active_pms,
|
has_active_pms as has_active_pms,
|
||||||
client_type as client_type,
|
client_type as client_type,
|
||||||
|
business_scope as business_scope,
|
||||||
active_pms_list as active_pms_list,
|
active_pms_list as active_pms_list,
|
||||||
active_accommodations_per_deal_segmentation
|
active_accommodations_per_deal_segmentation
|
||||||
as active_accommodations_per_deal_segmentation,
|
as active_accommodations_per_deal_segmentation,
|
||||||
|
|
|
||||||
|
|
@ -505,6 +505,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: main_deal_name
|
- name: main_deal_name
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1524,6 +1537,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: metric_from_date
|
- name: metric_from_date
|
||||||
data_type: date
|
data_type: date
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue