Qlik Community

Qlik Sense Enterprise Documents & Videos

Documents & videos about Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.

Master Calendar Code Template for 445 Fiscal Calendar

isaaclin
New Contributor III

Master Calendar Code Template for 445 Fiscal Calendar

A lot of company is using 4 week + 4 week + 5 week period pattern instead of using a calendar month, so the 12 calendar months will be regrouped into 12 periods.

 

Period 14 Weeks
Period 24 Weeks
Period 35 Weeks
Period 44 Weeks
Period 54 Weeks
Period 65 Weeks
Period 74 Weeks
Period 84 Weeks
Period 95 Weeks
Period 104 Weeks
Period 114 Weeks
Period 125 Weeks

There are some special conditions for Period 1 and Period 12

If the first week of the year is less than 3 days, this partial week plus the second week of the year will be considered a whole week,

for an example, the first week of 2016 contains only 2 days, so the first week of period 1 2016 has 9 days. and Period 1 is ending on Jan 30th.

another condition is Period 12 is always ended on Dec 31, no matter whether the last week of the year is a partial week.

My code had covered these two conditions when applying the code, you need to add a section called master calendar in data load editor , and then copy and paste the code to the section.

Next, find the code below from the very top of the code and change the field name " Date" to your field name of date.

Load

  Min("Date") as MinDate,

  Max("Date") as MaxDate

Click Load Data, you should get a calendar table with 12 Periods and all the calendar weeks are also classified into 445 week numbers.

such as Period 1 Week 1, Period 3 Week 5, etc. Note: only Period 3, 6, 9 ,12 have week 5.

There are also a lot of fields other than Period in the calendar table for you to use, please check your table viewer for details.

All comments and suggestions are welcomed, please send me message or emails.

Cheers

Attachments
Version history
Revision #:
1 of 1
Last update:
‎05-30-2016 08:12 AM
Updated by: