From 7a987d92c48f1898a83faed3835fad45662aca40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Mon, 2 Dec 2024 17:00:52 +0000 Subject: [PATCH] Merged PR 3731: Add 1e-6 threshold in kpis_additive_metrics_per_dimension_are_consistent # Description Add 1e-6 threshold in kpis_additive_metrics_per_dimension_are_consistent. This should fix the issue on churn rate metrics that are rounded to this precision # Checklist - [X] The edited models and dependants run properly with production data. Only tried the test. - [ ] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] 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: #25075 --- ...itive_metrics_per_dimension_are_consistent.sql | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/kpis_additive_metrics_per_dimension_are_consistent.sql b/tests/kpis_additive_metrics_per_dimension_are_consistent.sql index 2cbab91..a49bd53 100644 --- a/tests/kpis_additive_metrics_per_dimension_are_consistent.sql +++ b/tests/kpis_additive_metrics_per_dimension_are_consistent.sql @@ -4,13 +4,16 @@ specifically on reporting.mtd_aggregated_metrics. It just ensures that for the last available date, the sum of metrics for any dimension provides an equal or lower aggregated value compared -to what is expected at Global level. This is because some dimensions -depend on Deal, and not all users have a Deal, thus it's normal that -the aggregation might not match the Global value on a given metric. +to what is expected at Global level, up to a certain threshold. +This is because some dimensions depend on Deal, and not all users +have a Deal, thus it's normal that the aggregation might not match the +Global value on a given metric. -However, the aggregation cannot be higher than the value reported in -the Global dimension. +However, the aggregation cannot be higher, with a certain tolerance, +than the value reported in the Global dimension. */ +{% set tolerance_threshold = 0.000001 %} + {% set additive_metric_names = ( "Cancelled Bookings", "Check-In Hero Revenue", @@ -91,4 +94,4 @@ with ) select * from difference_computation -where abs_diff > 0 +where abs_diff > {{ tolerance_threshold }}