New to Qlik Analytics

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

Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!

Who Me Too'd this topic

madhubabu
Contributor III
Contributor III

Master Calendar code explanation

Hi Can anyone explain below code

Temp_Calendar_Range:
LOAD
Num(Date#(Min(Period), 'YYYYMM'))as MinDate,
Num(Date#(Max(Period), 'YYYYMM')) as MaxDate
RESIDENT [Main Data];

//--- Assign the start and end dates to variables
LET vMinDate = Peek('MinDate', 0, 'Temp_Calendar_Range');
LET vMaxDate = Peek('MaxDate', 0, 'Temp_Calendar_Range');
DROP TABLE Temp_Calendar_Range; // Cleanup

[Master Calendar]:
LOAD DISTINCT
Year(Temp_Date) * 100 + Month(Temp_Date) as [Period],
Year(Temp_Date) as [Year],
Month(Temp_Date) as [Month],
Date(Temp_Date, 'YYYY-MM') as [Year - Month],
'Q' & Ceil(Month(Temp_Date) / 3) as [Quarter]
;
LOAD DISTINCT
MonthStart($(vMinDate) + IterNo() - 1) as Temp_Date
AUTOGENERATE (1)
WHILE $(vMinDate) + IterNo() - 1 <= $(vMaxDate);
//--- Remove the temporary variables
LET vMinDate = Null();

LET vMaxDate = Null();

 

Thanks in advance,

Madhu

Labels (1)
Who Me Too'd this topic