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

@ -5592,3 +5592,34 @@ models:
data_type: numeric
description: |
The service fee charged by Superhog with taxes, in GBP.
- name: int_core__new_dash_deal_since_date
description: |
This model contains the deals that correspond to user hosts in New Dash.
While not the usual case, it's possible that a deal has more than one user
host. Thus this model aims to aggregate the first and last migration or
appearances dates for each deal. This is specially useful for KPIs purposes.
columns:
- name: id_deal
data_type: character varying
description: |
The unique identifier of the deal that is in New Dash.
data_tests:
- unique
- not_null
- name: min_user_in_new_dash_since_date_utc
data_type: date
description: |
The date when the first user host appeared in New Dash for this deal.
- name: max_user_in_new_dash_since_date_utc
data_type: date
description: |
The date when the last user host appeared in New Dash for this deal.
- name: total_new_dash_users
data_type: bigint
description: |
The total number of user hosts that have appeared in New Dash for this deal.