Hi Guys,
I have the next part of my riddle
I have a table like this :
with the select below I can obtain my desired result:
select distinct artikelnr, calender_week, imputed_calender_week from (
select distinct artikelnr
, datum
, calender_week
, first_value(menge) over (partition by artikelnr,calender_week
order by (case when menge is not null then 1 else 2 end), datum desc
) as imputed_calender_week
from test_table
where datum between '2021-02-01' and '2021-03-01') x
Now my problem is creating this as a view so that I can select the datum criteria. How can I do that?
Thanks in advance for any help.
Kingz
I have the next part of my riddle
I have a table like this :
with the select below I can obtain my desired result:
select distinct artikelnr, calender_week, imputed_calender_week from (
select distinct artikelnr
, datum
, calender_week
, first_value(menge) over (partition by artikelnr,calender_week
order by (case when menge is not null then 1 else 2 end), datum desc
) as imputed_calender_week
from test_table
where datum between '2021-02-01' and '2021-03-01') x
Now my problem is creating this as a view so that I can select the datum criteria. How can I do that?
Thanks in advance for any help.
Kingz