Merged PR 5069: Account revenue impact from growth in a monthly basis
# Description Creates an intermediate model to compute the impact in revenue (total or rrpr) due to the growth. This model also categorises the impact, and provides additional attributes for reporting purposes. This model aims to substitute, in time, the current existing version of `int_monthly_growth_score_by_deal`. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #29374
This commit is contained in:
parent
2873f6b980
commit
ca5be5c3cf
2 changed files with 543 additions and 0 deletions
|
|
@ -3504,3 +3504,296 @@ models:
|
|||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 1
|
||||
strictly: false
|
||||
|
||||
- name: int_monthly_account_revenue_impact_from_growth
|
||||
description: |
|
||||
This model computes the monthly revenue impact from the growth of
|
||||
billable items for each deal. The revenue impact is computed as the
|
||||
product of the growth score and the deal contribution to the total revenue
|
||||
in the previous 12 months.
|
||||
|
||||
There's 2 impact scores computed depending on the revenue metric, namely:
|
||||
- impact_score_total_revenue: based on Total Revenue
|
||||
- impact_score_revenue_retained_post_resolutions: based on Revenue Retained
|
||||
Post Resolutions
|
||||
|
||||
It is important to note that if we check the ongoing month, the count of
|
||||
billable items and the corresponding share will be based on the projection,
|
||||
rather than the actual figure. In this case, the MAE and MAPE of the projected
|
||||
value are indicated in the model.
|
||||
|
||||
While the growth and impact scores are computed at a monthly basis, their values
|
||||
will update every day with the latest available projection.
|
||||
|
||||
data_tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- end_date
|
||||
- id_deal
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- start_date
|
||||
- id_deal
|
||||
|
||||
columns:
|
||||
- name: start_date
|
||||
data_type: date
|
||||
description: |
|
||||
Start date of the period for which the revenue impact is computed.
|
||||
Corresponds to the first day of the month.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: end_date
|
||||
data_type: date
|
||||
description: |
|
||||
End date of the period for which the revenue impact is computed.
|
||||
Corresponds to the last day of the month.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: id_deal
|
||||
data_type: string
|
||||
description: |
|
||||
Unique ID for a deal, or account.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: deal
|
||||
data_type: string
|
||||
description: |
|
||||
Concatenation of the deal ID and the deal name.
|
||||
|
||||
- name: client_type
|
||||
data_type: string
|
||||
description: |
|
||||
Type of the client, PLATFORM or API.
|
||||
|
||||
- name: has_active_pms
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag indicating if the deal has an active PMS or not.
|
||||
|
||||
- name: active_pms_list
|
||||
data_type: string
|
||||
description: |
|
||||
List of active PMS for the deal. It can be null if the deal has no
|
||||
active PMS.
|
||||
|
||||
- name: main_billing_country_iso_3_per_deal
|
||||
data_type: string
|
||||
description: |
|
||||
Main billing country for the deal. It can be null.
|
||||
|
||||
- name: deal_lifecycle_state
|
||||
data_type: string
|
||||
description: |
|
||||
Lifecycle state of the deal.
|
||||
|
||||
- name: deal_hubspot_stage
|
||||
data_type: string
|
||||
description: |
|
||||
Hubspot stage of the deal.
|
||||
|
||||
- name: account_manager
|
||||
data_type: string
|
||||
description: |
|
||||
Account manager of the deal. It can be null.
|
||||
|
||||
- name: live_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Live date of the deal according to HubSpot. It can be null.
|
||||
|
||||
- name: cancellation_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Cancellation date of the deal according to HubSpot. It can be null.
|
||||
|
||||
- name: growth_score
|
||||
data_type: decimal
|
||||
description: |
|
||||
Growth score of the billable items, based on the average between:
|
||||
- The billable items of a given month vs. the average of the previous
|
||||
3 months.
|
||||
- The share a deal has in terms of billable items of a given month
|
||||
if compared to the rest of the deals vs. the average of the previous 3
|
||||
months.
|
||||
The growth score is capped between -1 and 1.
|
||||
It can be overridden to -1 in case the deal is cancelled in the same month.
|
||||
It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: -1
|
||||
max_value: 1
|
||||
strictly: false
|
||||
|
||||
- name: impact_score_total_revenue
|
||||
data_type: decimal
|
||||
description: |
|
||||
Impact score of the growth score on the total revenue.
|
||||
It is computed as the product of the growth score and the deal
|
||||
contribution to the total revenue in the previous 12 months.
|
||||
It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: -1
|
||||
max_value: 1
|
||||
strictly: false
|
||||
|
||||
- name: impact_score_revenue_retained_post_resolutions
|
||||
data_type: decimal
|
||||
description: |
|
||||
Impact score of the growth score on the revenue retained post
|
||||
resolutions. It is computed as the product of the growth score and
|
||||
the deal contribution to the revenue retained post resolutions in
|
||||
the previous 12 months.
|
||||
It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: -1
|
||||
max_value: 1
|
||||
strictly: false
|
||||
|
||||
- name: categorisation_impact_score_revenue_retained_post_resolutions
|
||||
data_type: string
|
||||
description: |
|
||||
Categorisation of the impact score on the revenue retained post
|
||||
resolutions. It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values:
|
||||
- MAJOR DECLINE
|
||||
- DECLINE
|
||||
- FLAT
|
||||
- GAIN
|
||||
- MAJOR GAIN
|
||||
|
||||
- name: rank_impact_score_total_revenue
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly rank of the deal in terms of impact score on the total revenue.
|
||||
|
||||
- name: rank_impact_score_revenue_retained_post_resolutions
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly rank of the deal in terms of impact score on the revenue
|
||||
retained post resolutions.
|
||||
|
||||
- name: current_month_total_revenue_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Total revenue in GBP for the current month.
|
||||
If the month is in progress then this value will be null.
|
||||
|
||||
- name: rolling_12_months_total_revenue_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Total revenue in GBP for the previous 12 months.
|
||||
It can be null.
|
||||
|
||||
- name: share_total_revenue_rolling_12_months
|
||||
data_type: decimal
|
||||
description: |
|
||||
Share of the deal in terms of total revenue in the previous 12 months.
|
||||
It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: rank_total_revenue_rolling_12_months
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly rank of the deal in terms of total revenue in the previous
|
||||
12 months.
|
||||
|
||||
- name: current_month_revenue_retained_post_resolutions_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Revenue retained post resolutions in GBP for the current month.
|
||||
If the month is in progress then this value will be null.
|
||||
|
||||
- name: rolling_12_months_revenue_retained_post_resolutions_in_gbp
|
||||
data_type: decimal
|
||||
description: |
|
||||
Revenue retained post resolutions in GBP for the previous 12 months.
|
||||
It can be null.
|
||||
|
||||
- name: share_revenue_retained_post_resolutions_rolling_12_months
|
||||
data_type: decimal
|
||||
description: |
|
||||
Share of the deal in terms of revenue retained post resolutions in
|
||||
the previous 12 months.
|
||||
It cannot be null.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: rank_revenue_retained_post_resolutions_rolling_12_months
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly rank of the deal in terms of revenue retained post
|
||||
resolutions in the previous 12 months.
|
||||
|
||||
- name: current_month_billable_items
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly billable items. If the month is in progress
|
||||
then this value might be projected.
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: share_billable_items_current_month
|
||||
data_type: decimal
|
||||
description: |
|
||||
Share of the billable items for a given deal in the current month.
|
||||
If the month is in progress then this value might be projected.
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: rank_billable_items_current_month
|
||||
data_type: integer
|
||||
description: |
|
||||
Monthly rank of the deal in terms of billable items in the current month.
|
||||
If the month is in progress then this value might be projected.
|
||||
|
||||
- name: projection_mean_absolute_error
|
||||
data_type: decimal
|
||||
description: |
|
||||
Mean absolute error of the projection of the billable items.
|
||||
It is null if the month is not in progress or value is projected
|
||||
but there's no prior data to compare the projection against.
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: projection_mean_absolute_percentage_error
|
||||
data_type: decimal
|
||||
description: |
|
||||
Mean absolute percentage error of the projection of the billable items.
|
||||
It is null if the month is not in progress or value is projected
|
||||
but there's no prior data to compare the projection against.
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: are_billable_items_projected
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag indicating if the billable items are projected or not.
|
||||
If the month is in progress then this value might be projected.
|
||||
It can be null if there's no projection for that deal.
|
||||
|
||||
- name: is_growth_score_overridden_due_to_cancellation
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag indicating if the growth score is overridden to -1 due to
|
||||
cancellation in the same month.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue