Skip to content

Instantly share code, notes, and snippets.

@DarinLevesque
Created July 2, 2021 13:08
Show Gist options
  • Save DarinLevesque/bf43e4e69a3a22cc806834ef4284fb5e to your computer and use it in GitHub Desktop.
Save DarinLevesque/bf43e4e69a3a22cc806834ef4284fb5e to your computer and use it in GitHub Desktop.
Qlik Sense Master Calendar
MasterCalendar:
Load
TempDate AS OrderDate,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
'Q' & ceil(month(TempDate) / 3) AS Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
;
//=== Generate a temp table of dates ===
LOAD
date(mindate + IterNo()) AS TempDate
,maxdate // Used in InYearToDate() above, but not kept
WHILE mindate + IterNo() <= maxdate;
//=== Get min/max dates from Field ===/
LOAD
min(FieldValue('OrderDate', recno()))-1 as mindate,
max(FieldValue('OrderDate', recno())) as maxdate
AUTOGENERATE FieldValueCount('OrderDate');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment