Merged PR 3247: Enriches monthly_growth_by_deal model for top losers reporting
# Description Changes: * Explicit selection of fields in the last part of the query, rather than select *. * Adding a few more Hubspot attributes, namely: AM, Hubspot Stage, Live Date and Cancellation Date. The main idea is to enrich the reporting with these. * Adding the listings over 12 months. Here it's a bit more tricky than for Revenue or Bookings, since to me the main indicator is the amount of listings that are being booked in a month, over a period of 12 months (rather than unique count of listings that have been booked in the past 12 months). However, doing a sum of the listings booked in month will be very tricky for AMs and other users. I opted for averaging, and can be considered as, in average, a certain account has X amount of listings with bookings created, and this average considers the past 12 months. So I'd say it's a good estimate of the "real" size of a client in terms of potential for Superhog. # 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. - [NA] I have checked for DRY opportunities with other models and docs. - [NA] 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: #22883
This commit is contained in:
parent
5735251c67
commit
f230eb3af5
4 changed files with 279 additions and 9 deletions
|
|
@ -9,6 +9,10 @@ select
|
|||
main_deal_name as main_deal_name,
|
||||
main_billing_country_iso_3_per_deal as main_billing_country_iso_3_per_deal,
|
||||
deal_lifecycle_state as deal_lifecycle_state,
|
||||
deal_hubspot_stage as deal_hubspot_stage,
|
||||
account_manager as account_manager,
|
||||
live_date_utc as live_date_utc,
|
||||
cancellation_date_utc as cancellation_date_utc,
|
||||
|
||||
given_month_first_day_month as given_month_first_day_month,
|
||||
previous_1_month_first_day_month as previous_1_month_first_day_month,
|
||||
|
|
@ -50,6 +54,15 @@ select
|
|||
deal_contribution_rank_to_global_created_bookings
|
||||
as deal_contribution_rank_to_global_created_bookings,
|
||||
|
||||
deal_avg_listings_booked_in_month_12_months_window
|
||||
as deal_avg_listings_booked_in_month_12_months_window,
|
||||
global_avg_listings_booked_in_month_12_months_window
|
||||
as global_avg_listings_booked_in_month_12_months_window,
|
||||
deal_contribution_share_to_global_avg_listings_booked_in_month
|
||||
as deal_contribution_share_to_global_avg_listings_booked_in_month,
|
||||
deal_contribution_rank_to_global_avg_listings_booked_in_month
|
||||
as deal_contribution_rank_to_global_avg_listings_booked_in_month,
|
||||
|
||||
deal_revenue_12_months_window as deal_revenue_12_months_window,
|
||||
effective_deal_revenue_12_months_window as effective_deal_revenue_12_months_window,
|
||||
effective_global_revenue_12_months_window
|
||||
|
|
|
|||
|
|
@ -595,6 +595,28 @@ models:
|
|||
Identifier of the lifecycle state of a given deal
|
||||
in a given month.
|
||||
|
||||
- name: deal_hubspot_stage
|
||||
data_type: string
|
||||
description: |
|
||||
Current hubspot stage for a given deal.
|
||||
|
||||
- name: account_manager
|
||||
data_type: string
|
||||
description: |
|
||||
Current Account Manager in charge of a given deal, according
|
||||
to Hubspot.
|
||||
|
||||
- name: live_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date in which the account has gone live, according to Hubspot.
|
||||
|
||||
- name: cancellation_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date in which the account has been offboarded, according to
|
||||
Hubspot.
|
||||
|
||||
- name: given_month_first_day_month
|
||||
data_type: date
|
||||
description: |
|
||||
|
|
@ -986,7 +1008,7 @@ models:
|
|||
- name: global_created_bookings_12_months_window
|
||||
data_type: integer
|
||||
description: |
|
||||
Total created bookings generated by a deal
|
||||
Total created bookings generated by any deal
|
||||
in the months from the period ranging from the
|
||||
aggregated_revenue_from_first_day_month to
|
||||
aggregated_revenue_to_first_day_month.
|
||||
|
|
@ -1022,6 +1044,61 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: deal_avg_listings_booked_in_month_12_months_window
|
||||
data_type: decimal
|
||||
description: |
|
||||
Average listings booked in month by a deal
|
||||
in the months from the period ranging from the
|
||||
aggregated_revenue_from_first_day_month to
|
||||
aggregated_revenue_to_first_day_month.
|
||||
It cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: global_avg_listings_booked_in_month_12_months_window
|
||||
data_type: decimal
|
||||
description: |
|
||||
Sum of the average listings booked in month by
|
||||
any deal in the months from the period ranging from the
|
||||
aggregated_revenue_from_first_day_month to
|
||||
aggregated_revenue_to_first_day_month.
|
||||
It is used for the deal contribution share with respect
|
||||
to the global average listings booked in month.
|
||||
It cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: deal_contribution_share_to_global_avg_listings_booked_in_month
|
||||
data_type: decimal
|
||||
description: |
|
||||
Represents the size of the deal in terms of average listings
|
||||
booked in month.
|
||||
In other words, what's the percentage of the global average listings
|
||||
booked in month that can be attributed to this deal.
|
||||
It cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: deal_contribution_rank_to_global_avg_listings_booked_in_month
|
||||
data_type: decimal
|
||||
description: |
|
||||
Represents the ordered list of deals by descending size
|
||||
in terms of average listings booked in month.
|
||||
If more than one deal have the same share, the order is
|
||||
not under control.
|
||||
It cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: avg_mom_growth_score
|
||||
data_type: decimal
|
||||
description: |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue