Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sona_sa
Creator II
Creator II

MASTER CALENDAR CODE ERROR

Hi 

I am using below code for master calendar for future data : But is giving error : After this code there is print shot : Not able to find out, Why this error is giving :

QuartersMap:
MAPPING LOAD
rowno() as R_Month,
'Q' & Ceil (rowno()/3) as R_Quarter
AUTOGENERATE (12);

LET varMinDate=NUM('01/04/2021');
LET varMaxDate=NUM('31/03/2022');


TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);

MasterCalendar:
Load
TempDate,
//As "Recruitment DOJ",
week(TempDate) As R_Week,
Year(TempDate) As R_Year,
Month(TempDate) As R_Month,
Day(TempDate) As Day,
ApplyMap('QuartersMap', month(TempDate), Null()) as R_Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as R_WeekYear,
MonthName(TempDate) As R_YearMonth,
WeekDay(TempDate) as R_WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;

sona_sa_0-1620147352034.png

Thanks

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You are relying on automatic date parsing to create varMinDate and varMaxdate. Your script is set up to expect US MM/DD/YYYY dates.  '31/03/2022' is not a valid MM/DD/YYYY date so varMaxDate is therefore null.

When creating dates in script or expressions, it is better to use the explicit MakeDate() function. 

LET varMaxDate=NUM(MakeDate(2022,3,31));

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

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You are relying on automatic date parsing to create varMinDate and varMaxdate. Your script is set up to expect US MM/DD/YYYY dates.  '31/03/2022' is not a valid MM/DD/YYYY date so varMaxDate is therefore null.

When creating dates in script or expressions, it is better to use the explicit MakeDate() function. 

LET varMaxDate=NUM(MakeDate(2022,3,31));

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