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,
|
||||
case
|
||||
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
|
||||
end as days_between_live_and_churn,
|
||||
end as months_between_live_and_churn,
|
||||
d.last_contacted_date_utc,
|
||||
case
|
||||
when mabd.deal_lifecycle_state = '{{churned_state}}'
|
||||
|
|
@ -585,7 +594,11 @@ select
|
|||
d.amount_times_contacted,
|
||||
d.cancellation_category,
|
||||
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,
|
||||
|
||||
-- Windowed metrics
|
||||
|
|
|
|||
|
|
@ -1636,10 +1636,10 @@ models:
|
|||
Hubspot. It can be null if the deal has never
|
||||
churned.
|
||||
|
||||
- name: days_between_live_and_churn
|
||||
- name: months_between_live_and_churn
|
||||
data_type: integer
|
||||
description: |
|
||||
Number of days between the live date and the
|
||||
Number of months between the live date and the
|
||||
churn date.
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue