Merged PR 4444: Exposes ytd_mtd_aggregated_main_metrics_overview

# Description

Exposes ytd_mtd_aggregated_main_metrics_overview in reporting.

I changed a bit the logic for exclusion, I believe this is a bit more clear than how it's currently done for the mtd/monthly metrics.

# 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: #27609
This commit is contained in:
Oriol Roqué Paniagua 2025-02-19 09:26:05 +00:00
parent 7260368bad
commit 78ae3e0119
2 changed files with 196 additions and 0 deletions

View file

@ -1917,3 +1917,145 @@ models:
- name: is_deal_in_xero
data_type: boolean
description: "Flag to indicate if the deal is in Xero."
- name: ytd_mtd_aggregated_main_metrics_overview
description: |
This model provides a high-level overview of the main metrics for the month-to-date
and financial year-to-date periods. Data is aggregated at metric level, and provides
evolutions current month MTD vs. previous month EOM, current month MTD vs. previous
year MTD and current YTD vs. previous YTD.
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- dimension
- dimension_value
- metric_name
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- dimension
- dimension_value
- id_metric
columns:
- name: date
data_type: date
description: The date for the month-to-date and year-to-date metrics.
data_tests:
- not_null
- name: dimension
data_type: string
description: The dimension or granularity of the metrics.
data_tests:
- accepted_values:
values:
- global
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
data_tests:
- not_null
- name: calendar_year
data_type: integer
description: The calendar year associated with the data.
data_tests:
- not_null
- name: financial_year
data_type: integer
description: The financial year associated with the data.
data_tests:
- not_null
- name: previous_year_date
data_type: date
description: |
The equivalent date in the previous year. It can be null if the
metric is not available in the previous year
- name: id_metric
data_type: integer
description: |
Unique ID for this metric. It is preferable to use this ID when
building a report to ensure changes in the metric name do not
affect the report.
data_tests:
- not_null
- name: metric_name
data_type: string
description: |
Name of the metric. It is preferable to use the ID of the metric
when building a report to ensure changes in the metric name do not
affect the report.
data_tests:
- not_null
- name: is_latest_date
data_type: integer
description: |
Flag to indicate if it's the latest consolidated information for this metric.
Keep in mind that this can be different depending on the metric, as the invoicing
cycle limits the availability of the latest data for some metrics.
data_tests:
- not_null
- name: current_month_mtd
data_type: numeric
description: |
Value of the metric for the current month MTD.
- name: previous_month_eom
data_type: numeric
description: |
Value of the metric for the previous month EOM.
- name: previous_year_mtd
data_type: numeric
description: |
Value of the metric for the previous year MTD.
- name: current_year_ytd
data_type: numeric
description: |
Value of the metric for the current year YTD.
- name: previous_year_ytd
data_type: numeric
description: |
Value of the metric for the previous year YTD.
- name: diff_current_month_mtd_vs_previous_month_eom
data_type: numeric
description: |
Difference between the current month MTD and the previous month EOM.
- name: diff_current_month_mtd_vs_previous_year_mtd
data_type: numeric
description: |
Difference between the current month MTD and the previous year MTD.
- name: diff_current_ytd_vs_previous_ytd
data_type: numeric
description: |
Difference between the current year YTD and the previous year YTD.
- name: rel_diff_current_month_mtd_vs_previous_month_eom
data_type: numeric
description: |
Relative difference between the current month MTD and the previous month EOM.
- name: rel_diff_current_month_mtd_vs_previous_year_mtd
data_type: numeric
description: |
Relative difference between the current month MTD and the previous year MTD.
- name: rel_diff_current_ytd_vs_previous_ytd
data_type: numeric
description: |
Relative difference between the current year YTD and the previous year YTD.