Addressed comments and included changes in reporting
This commit is contained in:
parent
2461286c9c
commit
2d4cded48c
4 changed files with 80 additions and 5 deletions
|
|
@ -563,9 +563,18 @@ select
|
||||||
d.cancellation_date_utc,
|
d.cancellation_date_utc,
|
||||||
case
|
case
|
||||||
when mabd.deal_lifecycle_state = '{{churned_state}}'
|
when mabd.deal_lifecycle_state = '{{churned_state}}'
|
||||||
then coalesce(d.cancellation_date_utc, mabd.date) - d.live_date_utc
|
then
|
||||||
|
date_part(
|
||||||
|
'month',
|
||||||
|
age(coalesce(d.cancellation_date_utc, mabd.date), d.live_date_utc)
|
||||||
|
)
|
||||||
|
+ 12
|
||||||
|
* date_part(
|
||||||
|
'year',
|
||||||
|
age(coalesce(d.cancellation_date_utc, mabd.date), d.live_date_utc)
|
||||||
|
)
|
||||||
else null
|
else null
|
||||||
end as days_between_live_and_churn,
|
end as months_between_live_and_churn,
|
||||||
d.last_contacted_date_utc,
|
d.last_contacted_date_utc,
|
||||||
case
|
case
|
||||||
when mabd.deal_lifecycle_state = '{{churned_state}}'
|
when mabd.deal_lifecycle_state = '{{churned_state}}'
|
||||||
|
|
@ -585,7 +594,11 @@ select
|
||||||
d.amount_times_contacted,
|
d.amount_times_contacted,
|
||||||
d.cancellation_category,
|
d.cancellation_category,
|
||||||
case
|
case
|
||||||
when d.deal_hubspot_stage = '{{ live_stage }}' then true else false
|
when
|
||||||
|
mabd.deal_lifecycle_state = '{{churned_state}}'
|
||||||
|
and d.cancellation_date_utc is null
|
||||||
|
then true
|
||||||
|
else false
|
||||||
end as is_churning_from_inactivity,
|
end as is_churning_from_inactivity,
|
||||||
|
|
||||||
-- Windowed metrics
|
-- Windowed metrics
|
||||||
|
|
|
||||||
|
|
@ -1636,10 +1636,10 @@ models:
|
||||||
Hubspot. It can be null if the deal has never
|
Hubspot. It can be null if the deal has never
|
||||||
churned.
|
churned.
|
||||||
|
|
||||||
- name: days_between_live_and_churn
|
- name: months_between_live_and_churn
|
||||||
data_type: integer
|
data_type: integer
|
||||||
description: |
|
description: |
|
||||||
Number of days between the live date and the
|
Number of months between the live date and the
|
||||||
churn date.
|
churn date.
|
||||||
data_tests:
|
data_tests:
|
||||||
- dbt_expectations.expect_column_values_to_be_between:
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,20 @@ select
|
||||||
has_active_pms as has_active_pms,
|
has_active_pms as has_active_pms,
|
||||||
client_type as client_type,
|
client_type as client_type,
|
||||||
active_pms_list as active_pms_list,
|
active_pms_list as active_pms_list,
|
||||||
|
active_accommodations_per_deal_segmentation
|
||||||
|
as active_accommodations_per_deal_segmentation,
|
||||||
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,
|
||||||
deal_hubspot_stage as deal_hubspot_stage,
|
deal_hubspot_stage as deal_hubspot_stage,
|
||||||
account_manager as account_manager,
|
account_manager as account_manager,
|
||||||
live_date_utc as live_date_utc,
|
live_date_utc as live_date_utc,
|
||||||
cancellation_date_utc as cancellation_date_utc,
|
cancellation_date_utc as cancellation_date_utc,
|
||||||
|
months_between_live_and_churn as months_between_live_and_churn,
|
||||||
|
last_contacted_date_utc as last_contacted_date_utc,
|
||||||
|
days_between_last_contacted_and_churn as days_between_last_contacted_and_churn,
|
||||||
|
amount_times_contacted as amount_times_contacted,
|
||||||
|
cancellation_category as cancellation_category,
|
||||||
|
is_churning_from_inactivity as is_churning_from_inactivity,
|
||||||
created_bookings as created_bookings,
|
created_bookings as created_bookings,
|
||||||
listings_booked_in_month as listings_booked_in_month,
|
listings_booked_in_month as listings_booked_in_month,
|
||||||
total_revenue_in_gbp as total_revenue_in_gbp,
|
total_revenue_in_gbp as total_revenue_in_gbp,
|
||||||
|
|
|
||||||
|
|
@ -1560,6 +1560,22 @@ models:
|
||||||
Name of the active PMS associated with the deal. It can have more than
|
Name of the active PMS associated with the deal. It can have more than
|
||||||
one PMS associated with it. It can be null if it doesn't have any PMS associated.
|
one PMS associated with it. It can be null if it doesn't have any PMS associated.
|
||||||
|
|
||||||
|
- name: active_accommodations_per_deal_segmentation
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Segment value based on the number of listings booked in 12 months
|
||||||
|
for a given deal and date.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "0"
|
||||||
|
- "01-05"
|
||||||
|
- "06-20"
|
||||||
|
- "21-60"
|
||||||
|
- "61+"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: main_billing_country_iso_3_per_deal
|
- name: main_billing_country_iso_3_per_deal
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1596,6 +1612,44 @@ models:
|
||||||
Hubspot. It can be null if the deal has never
|
Hubspot. It can be null if the deal has never
|
||||||
churned.
|
churned.
|
||||||
|
|
||||||
|
- name: months_between_live_and_churn
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Number of months between the live date and the
|
||||||
|
churn date.
|
||||||
|
data_tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: false
|
||||||
|
|
||||||
|
- name: last_contacted_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
Date when the deal was last contacted according to
|
||||||
|
Hubspot.
|
||||||
|
|
||||||
|
- name: days_between_last_contacted_and_churn
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Number of days between the last contacted date
|
||||||
|
and the churn date.
|
||||||
|
data_tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: false
|
||||||
|
|
||||||
|
- name: amount_times_contacted
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Number of times the deal was contacted according
|
||||||
|
to Hubspot.
|
||||||
|
|
||||||
|
- name: is_churning_from_inactivity
|
||||||
|
data_type: boolean
|
||||||
|
description: |
|
||||||
|
Flag to identify if the deal is churning due to
|
||||||
|
inactivity because of lack of bookings in the past 12 months.
|
||||||
|
|
||||||
- name: created_bookings
|
- name: created_bookings
|
||||||
data_type: integer
|
data_type: integer
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue