Merged PR 4349: Xero metrics by Business Scope

# Description

Changes:
* Creation of a deal-based model that contains when a "deal has appeared in new dash". This is tricky because a Deal can still have multiple users, thus it needs to be attributed to a date. I've chosen the first user appearance for the rest of the metrics.
* Adaptation of dimension deals in KPIs to include a client type, that indicates if the deal is from APIs or not (Platform, i.e., Dashboard).
* Xero metrics by Business Scope. This is the previous "dash source" that I need to change in the previously worked models. I decided to include APIs in the segmentation since in most cases we distinguish old dash from new dash by just "anything that is not in new dash". This is very wrong for invoicing metrics, in which we have APIs. So this actually properly computes a client segmentation by scope.

Note that I'll need to handle the monthly/mtd metrics/agg for these 2 metric models (Resolutions + Invoiced revenue) separately.

# 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: #27356
This commit is contained in:
Oriol Roqué Paniagua 2025-02-11 15:13:42 +00:00
parent a2c2907817
commit 4867e8f6d0
7 changed files with 151 additions and 13 deletions

View file

@ -459,6 +459,16 @@ models:
description: |
Name of the active PMS associated with the deal. It can have more than
one PMS associated with it. It can be null if it doesn't have any PMS associated.
- name: client_type
data_type: string
description: |
Type of client associated with the deal.
data_tests:
- not_null
- accepted_values:
values:
- API
- PLATFORM
- name: main_billing_country_iso_3_per_deal
data_type: string
description: |
@ -3660,13 +3670,15 @@ models:
The unique key corresponds to the deepest granularity of the model,
in this case:
- date,
- id_deal.
- id_deal,
- business_scope.
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_deal
- business_scope
columns:
- name: date
@ -3681,6 +3693,19 @@ models:
data_tests:
- not_null
- name: business_scope
data_type: string
description: |
Business scope identifying the metric source.
data_tests:
- not_null
- accepted_values:
values:
- "Old Dash"
- "New Dash"
- "API"
- "UNSET"
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
@ -4009,13 +4034,15 @@ models:
The unique key corresponds to the deepest granularity of the model,
in this case:
- date,
- id_deal.
- id_deal,
- business_scope.
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_deal
- business_scope
columns:
- name: date
@ -4030,6 +4057,19 @@ models:
data_tests:
- not_null
- name: business_scope
data_type: string
description: |
Business scope identifying the metric source.
data_tests:
- not_null
- accepted_values:
values:
- "Old Dash"
- "New Dash"
- "API"
- "UNSET"
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |