If we want to look data by year, month, week and date wise we go for master calendar. Similarly we may have scenarios where we analyze loads of data for group of years and month.
How to Create a Master calendar:
We create the master calendar in Qlikview by writing the below script:
Step1: Here we use a Date field in Table1.
For Example: Table1: //Table name
Emp_id
Date
E_Hours
101
1/1/2001
3
102
2/1/2002
4
103
4/2/2004
6
104
6/3/2010
6
Step2: In that RESIDENT table (Table1) we capture the Minimum and Maximum date.
For Example: MinMax: LOADMin(Date) asMinDate, Max(Date) asMaxDate ResidentTable1;
Here we find the Minimum date (1/1/2001) and Maximum date (6/3/2010) from Table1.
Step3: Here we are using Let variable to save the Min and Max date.
Explanation: In the table TempCalendar we are loading the date Date ($(vMin) (stored in vMin variable) along with IterNo () by checking with the while condition While$(vMin) + IterNo () - 1 <= $(vMax) as Date field.
We using this Date field to create year, month, Quarter, date, week and day.