Fixed weekly and monthly granularity
This commit is contained in:
parent
e4fb1af349
commit
454d7648f6
1 changed files with 7 additions and 2 deletions
|
|
@ -38,8 +38,10 @@ with
|
|||
select *
|
||||
from {{ ref("int_kpis__agg_monthly_new_dash_accommodation_offered_services") }}
|
||||
),
|
||||
int_kpis__dimension_dates as (select * from {{ ref("int_kpis__dimension_dates") }}),
|
||||
all_dates as (
|
||||
select distinct date, dimension, dimension_value
|
||||
select distinct
|
||||
c.date, c.dimension, c.dimension_value, d.is_end_of_week, d.is_end_of_month
|
||||
from
|
||||
(
|
||||
select date, dimension, dimension_value
|
||||
|
|
@ -53,7 +55,8 @@ with
|
|||
union all
|
||||
select date, dimension, dimension_value
|
||||
from int_kpis__agg_daily_new_dash_accommodation_offered_services
|
||||
) combined
|
||||
) c
|
||||
left join int_kpis__dimension_dates d on c.date = d.date
|
||||
)
|
||||
select
|
||||
d.date,
|
||||
|
|
@ -140,6 +143,7 @@ left join
|
|||
on created.end_date = accommodation.date
|
||||
and created.dimension = accommodation.dimension
|
||||
and created.dimension_value = accommodation.dimension_value
|
||||
where d.is_end_of_week
|
||||
union all
|
||||
select
|
||||
d.date,
|
||||
|
|
@ -183,3 +187,4 @@ left join
|
|||
on created.end_date = accommodation.date
|
||||
and created.dimension = accommodation.dimension
|
||||
and created.dimension_value = accommodation.dimension_value
|
||||
where d.is_end_of_month
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue