Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
helge_jorg
Creator
Creator

Master calendar – edit min max date

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;

 

Labels (2)
5 Replies
jonathandienst

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);

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anil_Babu_Samineni

Perhaps this?

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(YearEnd(MakeDate(2030)));

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
helge_jorg
Creator
Creator
Author

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

Anil_Babu_Samineni

This is for whom?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
helge_jorg
Creator
Creator
Author

From the data load.