Commit e8c397d1 authored by Taylor A Murphy, PhD's avatar Taylor A Murphy, PhD 🚀

Merge branch '1679-move-cancelled_zuora_subscription-snippet-into-dbt' into 'master'

Resolve "Move cancelled_zuora_subscription snippet into dbt"

See merge request !1219
parents ec7fb459 bb9188b6
......@@ -5,7 +5,7 @@ with raw_mrr_totals_levelled AS (
), mrr_totals_levelled AS (
SELECT subscription_name,
SELECT subscription_name,
subscription_name_slugify,
sfdc_account_id,
oldest_subscription_in_cohort,
......@@ -42,7 +42,7 @@ with raw_mrr_totals_levelled AS (
mrr_totals_levelled.original_unit_of_measure AS retention_unit_of_measure,
coalesce(sum(mrr_totals_levelled.original_mrr), 0) AS retention_mrr
FROM list
INNER JOIN mrr_totals_levelled
INNER JOIN mrr_totals_levelled
ON retention_month = mrr_month
AND subscriptions_in_lineage = subscription_name_slugify
{{ dbt_utils.group_by(n=6) }}
......@@ -120,6 +120,8 @@ with raw_mrr_totals_levelled AS (
)
SELECT *
SELECT joined.*,
rank() over(partition by zuora_subscription_id, churn_type
order by retention_month asc) AS rank_churn_type_month
FROM joined
WHERE retention_month <= dateadd(month, -1, CURRENT_DATE)
......@@ -4,7 +4,7 @@ models:
- name: current_arr_segmentation_all_levels
description: '{{ doc("current_arr_segmentation_all_levels") }}'
columns:
- name: id
- name: id
description: "Subcription Slug, SFDC Account ID, or SFDC Ultimate Parent Account ID"
tests:
- not_null
......@@ -84,10 +84,10 @@ models:
- name: product_category
- name: unit_of_measure
- name: quantity
- name: sfdc_account_id
- name: sfdc_account_id
tests:
- not_null
- name: sfdc_account_name
- name: sfdc_account_name
tests:
- not_null
- name: ultimate_parent_account_id
......@@ -149,7 +149,7 @@ models:
- name: salesforce_account_id
description: 'Used only for joining to SFDC in Looker'
tests:
- not_null
- not_null
- name: retention_month
tests:
- not_null
......@@ -171,7 +171,7 @@ models:
- name: months_since_parent_account_cohort_start
tests:
- not_null
- name: quarters_since_parent_account_cohort_start
- name: quarters_since_parent_account_cohort_start
tests:
- not_null
- name: churn_type
......@@ -210,10 +210,12 @@ models:
- name: retention_unit_of_measure
- name: original_mrr
- name: retention_mrr
- name: rank_churn_type_month
description: Ranks the months of the churn type by subscription with the first month of the churn type being ranked 1.
- name: retention_sfdc_account_
description: '{{ doc("retention_sfdc_account_") }}'
columns:
columns:
- name: sfdc_account_id
tests:
- not_null
......@@ -261,7 +263,7 @@ models:
- name: retention_zuora_subscription_
description: '{{ doc("retention_zuora_subscription_") }}'
columns:
columns:
- name: zuora_subscription_name
tests:
- not_null
......@@ -305,4 +307,4 @@ models:
tests:
- not_null
- accepted_values:
values: ['5K to 50K', 'Under 5K', '50K to 100K','100K to 500K', '500K to 1M','1M and above']
\ No newline at end of file
values: ['5K to 50K', 'Under 5K', '50K to 100K','100K to 500K', '500K to 1M','1M and above']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment