Merged PR 3672: fixed outlier_detector
# Description PR to fix the kpis_daily_outlier_detector test. Previously it was using all values for the metric independently of the granularity, now is adding them up by daily value and no other metrics. # Checklist - [x] The edited models and dependants run properly with production data. - [ ] 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. fixed outlier_detector Related work items: #24590
This commit is contained in:
commit
0668c0beb4
1 changed files with 2 additions and 1 deletions
|
|
@ -4,12 +4,13 @@
|
||||||
with
|
with
|
||||||
-- Retrieve recent data based on the defined days_to_consider
|
-- Retrieve recent data based on the defined days_to_consider
|
||||||
recent_data as (
|
recent_data as (
|
||||||
select {{ date_column }}, {{ column_name }}
|
select {{ date_column }}, sum({{ column_name }}) as {{ column_name }}
|
||||||
from {{ model }}
|
from {{ model }}
|
||||||
where
|
where
|
||||||
{{ date_column }} between (
|
{{ date_column }} between (
|
||||||
current_date - interval '{{ days_to_consider + 1 }} days'
|
current_date - interval '{{ days_to_consider + 1 }} days'
|
||||||
) and (current_date - interval '1 day')
|
) and (current_date - interval '1 day')
|
||||||
|
group by {{ date_column }}
|
||||||
),
|
),
|
||||||
metrics_stats as (
|
metrics_stats as (
|
||||||
select
|
select
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue