Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Qlik experts,
In my master calendar I have set the max min dates based on one data source, where the min date is 1900 and max is YTD. My database has no expanded and I need to change the min and max dates to min 1900 and max to 2030.
Can someone please help me with this?
See below my master calendar:
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
Min(Dato) as minDate,
max(Dato) as maxDate
Resident Vaerdata;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Load
TempDate AS Dato,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
Do you mean to hard code the min and max dates? The current code should set the date range dynamically to your data, but if you do want fixed dates:
Let varMinDate = MakeDate(1900); // or MakeDate(1900,1,1); Let varMaxDate = MakeDate(2030, 12, 31);
Perhaps this?
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(YearEnd(MakeDate(2030)));
Thanks for your suggestions. But i can't get it to work. I get this error message:
The following error occurred:
Unexpected token: ',', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ...
The error occurred here:
TempCalendar:
LOAD
2 + Iterno()-1 As Num,
Date(2 + IterNo() - 1) as TempDate
AutoGenerate 1 While 2 + IterNo() -1 <= 47848>>>>>>,<<<<<<999999988
This is for whom?
From the data load.