Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.


Qlikview 12 New Week Numbering seems wrong?

Hi Everyone

I discovered that QV12 appears to support general week numbering natively but it doesn't work as I expect, can anyone help me understand how to use this feature?  Details follow..... (I'm using version 12.0.201 SR2)

QV 12 now generates the following new number interpretation variables in all new docs (default values shown)

SET FirstWeekDay=0;

SET BrokenWeeks=1;

SET ReferenceDay=0;

SET FirstMonthOfYear=1;

I thought, great, I can change these and have functions like Week() and WeekDay() etc respond appropriately but I didn't get the results that I expected.

Here's my example:

SET FirstWeekDay=5;  (weeks start on Saturday)

SET BrokenWeeks=0; (unbroken weeks)

SET ReferenceDay=0; (not applicable to unbroken weeks)

SET FirstMonthOfYear=1;  (default)

With these settings I get:

vDate = 03-Jan-2016  (my test date, this is a Sun)

Week(vDate) = 1 (we agree)

WeekYear(vDate) = 2015 (I expected 2016 because this is week 1 of 2016?)

WeekDay(vDate) = Sun (we agree)

Num(WeekDay(vDate)) = 1 (we agree)

A key characteristic is that WeekYear always seems to change between Sun & Mon (default behaviour) independent of FirstWeekDay!

It gets worse if I change FirstMonthOfYear=2 (Feb), eg:

YearStart(vDate) = 01-Jan-2016 (I expected 01-Feb-2015)

QuarterName(vDate) = Jan-Mar 2016 (I expected Nov-Jan ?)

Clearly I have misunderstood something, can anyone help?



Tags (2)
4 Replies
Contributor II

Re: Qlikview 12 New Week Numbering seems wrong?

Hi Robin,

Have you ever found a solution for this problem?

I am having the same issue. I set the variables to give me the first Sunday of 2016 that includes the day 4 of Jan, which should be the week of the 1/3/2016.

Qlik gives the the right day, but gives me year 2015. So the result is like below.




and so on.

This is causing my weeks to be off a whole week, therefore giving wrong totals.



Re: Qlikview 12 New Week Numbering seems wrong?

Sorry, No Luiz but good to have you confirm it's not just me!  I ended sticking with my QV11 Calendar script, it's based on HIC's post Redefining the Week Numbers  I think I found a bug in his script for broken weeks but I have never followed it up with him and it may just be my interpretation of the definitions.


Contributor II

Re: Qlikview 12 New Week Numbering seems wrong?

I think it is a bug with the WeekYear function.

I applied the changes from the HIC post Redefining the Week Numbers, but the year 2015 for the first day of the week 1 is still showing.



Contributor II

Re: Qlikview 12 New Week Numbering seems wrong?


Someone else helped me with the new Master Calendar script and it worked. The date of the first Sunday of the year now has 2016 as the year.

Find the link to the post below:

WeekYear giving wrong year