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
This commit is contained in:
Oriol Roqué Paniagua 2024-12-02 17:00:52 +00:00
parent 4c7820608a
commit 7a987d92c4

View file

@ -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 }}