Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyc40
Creator
Creator

Given a start date, how to display 8 week intervals

I'm trying to duplicate this table in excel, where I have measures based on date intervals. 

shirleyc40_0-1613594309095.png

In excel, you can refer to other cells to do the math, but I'm not sure how to do this in Qlik

Labels (1)
1 Solution

Accepted Solutions
4 Replies
shirleyc40
Creator
Creator
Author

Do you know how I can do two of these while loads and concatenate them? I want to mimic the 4 week one in the middle.

I have this right now

shirleyc40_0-1614027025885.png

 

edwin
Master II
Master II

Try this

 

load date(FirstWeek + (iterno()-1)*28) as WeekStart, date(FirstWeek + iterno()*28 -1) as WeekEnd, 'W'&iterno() as WeekNumber while date(FirstWeek + iterno()*28 -1)<=EndOfPeriod;
load date('2/24/2018') as FirstWeek, date('11/30/2018') as EndOfPeriod AutoGenerate (1);

 

 

2/24/2018 is a Saturday so your last day  should be 11/30 which is a Friday

edwin
Master II
Master II

this should be clearer

load date(FirstWeek + (iterno()-1)*4*7) as WeekStart, date(FirstWeek + iterno()*4*7 -1) as WeekEnd, 'W'&iterno() as WeekNumber while date(FirstWeek + iterno()*4*7 -1)<=EndOfPeriod;
load date('2/24/2018') as FirstWeek, date('11/30/2018') as EndOfPeriod AutoGenerate (1);