addressed comments

This commit is contained in:
Joaquin Ossa 2025-03-07 11:32:09 +01:00
parent 2d4cded48c
commit f8362c4a71
4 changed files with 36 additions and 10 deletions

View file

@ -593,13 +593,20 @@ select
end as days_between_last_contacted_and_churn, end as days_between_last_contacted_and_churn,
d.amount_times_contacted, d.amount_times_contacted,
d.cancellation_category, d.cancellation_category,
case
when mabd.deal_lifecycle_state = '{{churned_state}}' then true else false
end as is_churning,
case case
when when
mabd.deal_lifecycle_state = '{{churned_state}}' mabd.deal_lifecycle_state = '{{churned_state}}'
and d.cancellation_date_utc is null and d.cancellation_date_utc is null
then true then 'INACTIVITY'
else false when
end as is_churning_from_inactivity, mabd.deal_lifecycle_state = '{{churned_state}}'
and d.cancellation_date_utc is not null
then 'ACCOUNT CANCELLATION'
else null
end as churn_reason,
-- Windowed metrics -- Windowed metrics
coalesce(mabd.sum_created_bookings, 0) as created_bookings, coalesce(mabd.sum_created_bookings, 0) as created_bookings,

View file

@ -1668,11 +1668,20 @@ models:
Number of times the deal was contacted according Number of times the deal was contacted according
to Hubspot. to Hubspot.
- name: is_churning_from_inactivity - name: is_churning
data_type: boolean data_type: boolean
description: | description: |
Flag to identify if the deal is churning due to Flag to identify if the deal is churning or not.
inactivity because of lack of bookings in the past 12 months.
- name: churn_reason
data_type: string
description: |
Reason why the deal is churning.
data_tests:
- accepted_values:
values:
- "INACTIVITY"
- "ACCOUNT CANCELLATION"
- name: created_bookings - name: created_bookings
data_type: integer data_type: integer

View file

@ -28,7 +28,8 @@ select
days_between_last_contacted_and_churn as days_between_last_contacted_and_churn, days_between_last_contacted_and_churn as days_between_last_contacted_and_churn,
amount_times_contacted as amount_times_contacted, amount_times_contacted as amount_times_contacted,
cancellation_category as cancellation_category, cancellation_category as cancellation_category,
is_churning_from_inactivity as is_churning_from_inactivity, is_churning as is_churning,
churn_reason as churn_reason,
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,

View file

@ -1644,11 +1644,20 @@ models:
Number of times the deal was contacted according Number of times the deal was contacted according
to Hubspot. to Hubspot.
- name: is_churning_from_inactivity - name: is_churning
data_type: boolean data_type: boolean
description: | description: |
Flag to identify if the deal is churning due to Flag to identify if the deal is churning or not.
inactivity because of lack of bookings in the past 12 months.
- name: churn_reason
data_type: string
description: |
Reason why the deal is churning.
data_tests:
- accepted_values:
values:
- "INACTIVITY"
- "ACCOUNT CANCELLATION"
- name: created_bookings - name: created_bookings
data_type: integer data_type: integer