KPIs outlier detector
This commit is contained in:
parent
059c92b345
commit
e44a9c19fc
2 changed files with 99 additions and 16 deletions
|
|
@ -1,16 +1,22 @@
|
|||
with
|
||||
stg_core__country as (select * from {{ ref("stg_core__country") }}),
|
||||
stg_core__currency as (select * from {{ ref("stg_core__currency") }})
|
||||
select
|
||||
co.id_country,
|
||||
co.iso_2,
|
||||
co.iso_3,
|
||||
co.country_name,
|
||||
co.iso_num_code,
|
||||
co.phone_code,
|
||||
co.id_preferred_currency,
|
||||
cu.currency_name as preferred_currency_name,
|
||||
cu.iso4217_code as preferred_iso4217_code,
|
||||
co.dwh_extracted_at_utc
|
||||
from stg_core__country as co
|
||||
left join stg_core__currency cu on cu.id_currency = co.id_preferred_currency
|
||||
{% set sigma_threshold = var("sigma_threshold", 3) %}
|
||||
{% set days_to_consider = 14 %}
|
||||
{% set yesterday = "(current_date - interval '1 day')" %}
|
||||
|
||||
-- with
|
||||
-- stg_core__country as (select * from {{ ref("stg_core__country") }}),
|
||||
-- stg_core__currency as (select * from {{ ref("stg_core__currency") }})
|
||||
-- select
|
||||
-- co.id_country,
|
||||
-- co.iso_2,
|
||||
-- co.iso_3,
|
||||
-- co.country_name,
|
||||
-- co.iso_num_code,
|
||||
-- co.phone_code,
|
||||
-- co.id_preferred_currency,
|
||||
-- cu.currency_name as preferred_currency_name,
|
||||
-- cu.iso4217_code as preferred_iso4217_code,
|
||||
-- co.dwh_extracted_at_utc
|
||||
-- from stg_core__country as co
|
||||
-- left join stg_core__currency cu on cu.id_currency = co.id_preferred_currency
|
||||
|
||||
select {{ yesterday }} - interval '{{ days_to_consider }} "days"'
|
||||
Loading…
Add table
Add a link
Reference in a new issue