Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Rahul6
Contributor
Contributor

master calendar

I tried to create master calendar but i couldn't can someone explain what is the issue with script below

 

T1:
LOAD DATE,
SALES
FROM
[C:\Users\Rashmika\Desktop\qlik docs\MASTER CALENDAR.xlsx]
(ooxml, embedded labels, table is Sheet1);

TEMP:
Load
min(DATE) as mindate,
max(DATE) as maxdate
resident T1;
let Vmindate =NUM(peek('mindate',0,'TEMP'));
let Vmaxdate =NUM(peek('maxdate',0,'TEMP'));

CALENDAR:
load
day(DATE)as Day,
week(DATE)as Week,
month(DATE)as Month,
'Q'&Ceil(month(DATE)/3) as Quarter,
year(DATE)as Year resident T1;

T2:
LOAD
DATE($(Vmindate)+IterNo()-1) as DATE
while($(Vmindate)+IterNo()-1)<= DATE($(Vmaxdate));

 

 

 

 

3 Replies
rwunderlich
MVP
MVP

The second part should be a preceding load, not a resident load. Like this:

CALENDAR:
load
day(DATE)as Day,
week(DATE)as Week,
month(DATE)as Month,
'Q'&Ceil(month(DATE)/3) as Quarter,
year(DATE)as Year
;

LOAD
DATE($(Vmindate)+IterNo()-1) as DATE
while($(Vmindate)+IterNo()-1)<= DATE($(Vmaxdate));

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Rahul6
Contributor
Contributor
Author

I have already tried the above suggestion before posting the Query but i did not get the data as it has to be @rwunderlich  

Below is the image of the table which i got by applying the preceding load 
 

rwunderlich
MVP
MVP

You are missing "Autogenerate 1" in the bottom load. Here is the correct script. 

CALENDAR:
load
DATE,
day(DATE)as Day,
week(DATE)as Week,
month(DATE)as Month,
'Q'&
Ceil(month(DATE)/3) as Quarter,
year(DATE)as Year
;

LOAD
DATE($(Vmindate)+IterNo()-1) as DATE
AutoGenerate 1
while($(Vmindate)+IterNo()-1)<= $(Vmaxdate); 

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com