Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik_Developer1
Contributor II
Contributor II

How to create master calendar by using month year

I have only one single variable like current month= 2021-11

So based on this how to create master calendar

Thanks

1 Reply
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

You'll need start date and end date to create a master calendar.

If you have only one 2021-11, you can convert that into monthstart and monthend dates using Makedate() function

e.g

LET vMinDate = MakeDate(2021,11,1);

LET vMaxDate = MonthEnd(MakeDate(2021,11,1))

 

And use below script for calendar generation.

 

TempCalendar:

LOAD

  $(vMinDate) + IterNo() - 1 as Num,

  Date($(vMinDate) + IterNo() - 1) as TempDate

AutoGenerate

  1 While $(vMinDate) + IterNo() -1 <= $(vMaxDate);

 

MasterCalendar:

LOAD

  TempDate as Date,

  Week(TempDate) as Week,

  Year(TempDate) as Year,

  Month(TempDate) as Month,

  Day(TempDate) as Day,

  Weekday(TempDate) as WeekDay,

  'Q' & ceil(month(TempDate) / 3) as Quarter,

  'Q' & Ceil(Month(TempDate)/3) & '-' & Year(TempDate) as QuarterYear,

  MonthName(TempDate) as MonthYear,

  Week(TempDate)&'-'&Year(TempDate) as WeekYear

Resident TempCalendar

Order By TempDate ASC;

 

DROP Table TempCalendar;

 

Thanks,

Ashutosh