Merged PR 3678: Changed filters
# Description Changed filters on the calculation of the aggregated metrics. There was an issue before with the filter for the yearly metrics and I modified the ones for monthly as well to help with performance. # 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. - [ ] 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. Changed filters Related work items: #24604
This commit is contained in:
commit
fd7a993085
1 changed files with 5 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ with
|
||||||
date_trunc('week', {{ yesterday }} - interval '1 year') as py_week_start, -- Start of the same week last year
|
date_trunc('week', {{ yesterday }} - interval '1 year') as py_week_start, -- Start of the same week last year
|
||||||
date_trunc('week', {{ yesterday }} - interval '1 year') + (
|
date_trunc('week', {{ yesterday }} - interval '1 year') + (
|
||||||
{{ yesterday }} - date_trunc('week', {{ yesterday }})
|
{{ yesterday }} - date_trunc('week', {{ yesterday }})
|
||||||
) as py_week_current_date,
|
) as py_week_current_date, -- Start of the same week in the previous year
|
||||||
date_trunc('week', {{ yesterday }} - interval '1 week') as pp_week_start, -- Start of the same week in the previous period
|
date_trunc('week', {{ yesterday }} - interval '1 week') as pp_week_start, -- Start of the same week in the previous period
|
||||||
date_trunc('month', {{ yesterday }} - interval '1 year') as py_month_start,
|
date_trunc('month', {{ yesterday }} - interval '1 year') as py_month_start,
|
||||||
date_trunc('year', {{ yesterday }}) as current_year_start,
|
date_trunc('year', {{ yesterday }}) as current_year_start,
|
||||||
|
|
@ -72,7 +72,7 @@ with
|
||||||
end
|
end
|
||||||
) as pp_value
|
) as pp_value
|
||||||
from int_kpis__product_guest_daily_metrics dm, date_ranges dr
|
from int_kpis__product_guest_daily_metrics dm, date_ranges dr
|
||||||
where extract(day from date_day) <= dr.current_day_of_month
|
where dm.date_day >= dr.py_year_start
|
||||||
group by
|
group by
|
||||||
metric, has_payment, has_id_check, main_billing_country_iso_3_per_deal
|
metric, has_payment, has_id_check, main_billing_country_iso_3_per_deal
|
||||||
union all
|
union all
|
||||||
|
|
@ -101,7 +101,9 @@ with
|
||||||
end
|
end
|
||||||
) as pp_value
|
) as pp_value
|
||||||
from int_kpis__product_guest_daily_metrics dm, date_ranges dr
|
from int_kpis__product_guest_daily_metrics dm, date_ranges dr
|
||||||
where extract(day from date_day) <= dr.current_day_of_month
|
where
|
||||||
|
dm.date_day >= dr.py_month_start
|
||||||
|
and extract(day from date_day) <= dr.current_day_of_month
|
||||||
group by
|
group by
|
||||||
metric, has_payment, has_id_check, main_billing_country_iso_3_per_deal
|
metric, has_payment, has_id_check, main_billing_country_iso_3_per_deal
|
||||||
union all
|
union all
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue