You are on page 1of 1

Generating a Master Calendar

Why do you need a master calendar? How is the calendar created?


• Fills gaps in the data 1. Acquire range
• Allows you to generate additional fields
• WeekNum, Month, Year, etc…

Use MIN() and MAX() to find the smallest Use ORDER BY to pre-sort the date field.
(earliest) and largest (latest) dates in the system. Use PEEK() to retrieve the first and last values.

Store the start and end dates as variables.


2. Generate temporary calendar
TemporaryCalendar:
LOAD
DATE($(vStartDate) + ROWNO() - 1) AS TempDate
2 AUTOGENERATE
Without Master Calendar
$(vEndDate) - $(vStartDate) + 1;
1 3. Generate master calendar
• Each data point represents
It’s not clear that MasterCalendar:
a transaction
there was no activity on LOAD
• This could mean lost insights
15/06/2015 TempDate AS OrderDate,
WEEK(TempDate) AS Week,
YEAR(TempDate) AS Year,
MONTH(TempDate) AS Month,
DAY(TempDate) AS Day,
2 WEEKDAY (TempDate) AS Weekday,
1
With Master Calendar 'Q' & CEIL(MONTH(TempDate) / 3) AS Quarter,
DATE(MONTHSTART(TempDate), 'MMM-YYYY') AS MonthYear,
WEEK(TempDate) & '-' & YEAR(TempDate) AS WeekYear
• Now we see $0 sales on the 15th RESIDENT TemporaryCalendar;
3
DROP TABLE TemporaryCalendar;

© 2019 QlikTech International AB. All rights reserved. Qlik®, Qlik Sense®, QlikView®, QlikTech®, Qlik Cloud®, Qlik DataMarket®, Qlik Analytics Platform®, Qlik NPrinting®, Qlik Connectors®, Qlik GeoAnalytics®, Qlik Core®, Associative Difference®, Lead with Data™, Qlik Data Catalyst™, Qlik Associative
Big Data Index™, Qlik Insight Bot™ and the QlikTech logos are trademarks of QlikTech International AB that, where indicated by an “®”, have been registered in one or more countries. Other marks and logos mentioned herein are trademarks or registered trademarks of their respective owners.

You might also like