Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Generate weeks between two dates

Hi folks,

I made mistake in my script and don't know where, 

so i create a script to generate weeks between two dates 

 

 

MinMaxDate:
LOAD
%_KEY, 
MIN(StartWeek) AS MinDate, 
MAX(weekstart(Today())) AS MaxDate 
RESIDENT WI
GROUP BY %_KEY

JOIN (WI)
LOAD
%_KEY,
iterno()+MinDate as Dim_WI.StartWeek 
RESIDENT MinMaxDate

While iterno()+ MinDate <= MaxDate;

 

And it's generate only days between, could you please help ?

1 Solution

Accepted Solutions
Kushal_Chawda

@Micki  try below

MinMaxDate:
LOAD
%_KEY, 
MIN(StartWeek) AS MinDate, 
MAX(weekstart(Today())) AS MaxDate 
RESIDENT WI
GROUP BY %_KEY

JOIN (WI)
LOAD
%_KEY,
Weekstart(MinDate,iterno()-1) as Dim_WI.StartWeek 
RESIDENT MinMaxDate
While Weekstart(MinDate,iterno()-1) <= MaxDate;

View solution in original post

4 Replies
Kushal_Chawda

@Micki  how weeks should look like?

Micki
Creator
Creator
Author

Hi @Kushal_Chawda , I am using with weekstart() so format: 05/10/2020 , 12/10/2020 and so on 

Kushal_Chawda

@Micki  try below

MinMaxDate:
LOAD
%_KEY, 
MIN(StartWeek) AS MinDate, 
MAX(weekstart(Today())) AS MaxDate 
RESIDENT WI
GROUP BY %_KEY

JOIN (WI)
LOAD
%_KEY,
Weekstart(MinDate,iterno()-1) as Dim_WI.StartWeek 
RESIDENT MinMaxDate
While Weekstart(MinDate,iterno()-1) <= MaxDate;
Micki
Creator
Creator
Author

@Kushal_Chawda  Thank you! it's working