Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

WeekYear giving wrong year

Hello experts,

I believe that QlikSense might have an issue with the Master Calendar script.

I am applying the set variables below so that I set the week that contains the 4th day of January as the week 1. So the variables are set as below:

SET FirstWeekDay=6; (Sunday)

SET BrokenWeeks=0; (Unbroken Weeks)

SET ReferenceDay=4; (contain day 4 of January)

It supposed to work fine, but my results are giving me the date of the first Sunday of the year that contains the day 4 of January with the previous year (2015)

This is causing the fact data to recognize the week that starts on 1/10/2016 as the first Sunday of year 2016, and therefore the first week of the year. All my results are one week off.

Is there a bug in Qlik or it is a problem with the Master Calendar script?

Thanks in advance,


12 Replies

Can't see how you are linking this table or calculating the two other fields.

The calendar itself seems to work for me:

2016-08-15 22_42_22-Kalender.png

Creator III
Creator III


It actually works fine. On our data source we are missing the first week of the year so it is not mapping.

I will work with the analyst to see how we can fill this gap.

Thank you for your help.


Using: Qlik Sense

I was having the exact same issue with the erroneous year outcome, under the same SET conditions:

SET FirstWeekDay=6;
//Setting Sunday as the week start
SET BrokenWeeks=0;
// Broken Weeks not allowed
SET ReferenceDay=4;
//Jan 4th always belongs to week 1


Seems the weekyear function still has a bug/anomaly that I can't fathom, where the function displays the year of the first day of the new year as the year prior:


2020 in pink above should be 2021.

The way I fixed it was quite simple in the end.  I have simply added a function the auto-calendar in the LOAD script ( I have also concatenated a week function to it for my own calendar):



The year part is simply:


So in the AutoCalendar the "$1" represents the date field in the app you have, and it's adding 1 day to the field, and then doing the weekyear logic from there.

I have done it, and then reconciled data outcomes to annual calendar transitions over several years, using this website as a link for the calendar matching my SET conditions, and its fine:

HTH someone else