Add week number to model
This commit is contained in:
parent
ef03c0b60f
commit
220e96749c
5 changed files with 31 additions and 2 deletions
|
|
@ -3,7 +3,15 @@ with
|
|||
select distinct has_payment, has_id_check
|
||||
from {{ ref("int_kpis__metric_daily_check_in_attributed_guest_journeys") }}
|
||||
)
|
||||
select d.date_day, ud.has_payment, ud.has_id_check
|
||||
select
|
||||
d.date_day,
|
||||
case
|
||||
when d.iso_week_of_year < 10
|
||||
then concat('Week-0', d.iso_week_of_year)
|
||||
else concat('Week-', d.iso_week_of_year)
|
||||
end as date_week,
|
||||
ud.has_payment,
|
||||
ud.has_id_check
|
||||
from {{ ref("int_dates") }} as d
|
||||
cross join unique_dimensions as ud
|
||||
where d.date_day >= {{ var("start_date") }}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ with
|
|||
guest_kpis as (
|
||||
select
|
||||
dd.date_day,
|
||||
dd.date_week,
|
||||
dd.has_payment,
|
||||
dd.has_id_check,
|
||||
gj.created_guest_journeys_not_cancelled,
|
||||
|
|
@ -76,6 +77,7 @@ with
|
|||
|
||||
select
|
||||
gk.date_day,
|
||||
gk.date_week,
|
||||
gk_py.date_day as py_date_day,
|
||||
gk.has_payment,
|
||||
gk.has_id_check,
|
||||
|
|
@ -135,4 +137,4 @@ left join
|
|||
and gk.has_id_check = gk_py.has_id_check
|
||||
-- Here we use a group by because of leap days that generate duplicity when being
|
||||
-- moved to another year
|
||||
group by gk.date_day, gk_py.date_day, gk.has_payment, gk.has_id_check
|
||||
group by gk.date_day, gk.date_week, gk_py.date_day, gk.has_payment, gk.has_id_check
|
||||
|
|
|
|||
|
|
@ -5885,6 +5885,12 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: date_week
|
||||
data_type: string
|
||||
description: "Week number of when Guest Journeys have been completed."
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: has_payment
|
||||
data_type: string
|
||||
description: Has there been any guest payments on the guest journey.
|
||||
|
|
@ -5933,6 +5939,12 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: date_week
|
||||
data_type: string
|
||||
description: "Week number of when Guest Journeys have been completed."
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: py_date_day
|
||||
data_type: date
|
||||
description: |
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ with
|
|||
|
||||
select
|
||||
date_day as date_day,
|
||||
date_week as date_week,
|
||||
py_date_day as py_date_day,
|
||||
has_payment as has_payment,
|
||||
has_id_check as has_id_check,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,12 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: date_week
|
||||
data_type: string
|
||||
description: "Week number of when Guest Journeys have been completed."
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: py_date_day
|
||||
data_type: date
|
||||
description: |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue