Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
The output of Week() function seems to be wrong, while output of Today(2) and WeekStart(Today(2)) is right. The current week number of today (5th of September 2016) should be 36, but the output of Week() is 37 instead. I've checked system and QlikView server date/time and these are fine.
It doesn't matter on which day I test this, the week number is always 1 too much. I've attached QlikView's output. Of course it's easy to get around this by using Week(Today(2)-1), but that shouldn't be necessary.
Has anyone came across this issue? Any help is highly appreciated.
Best regards,
Roland Bouman
I can't reproduce this in my system, it's returning the correct week.
Which QV version are you running? And have you maybe modified the system variables that control calendar functions in your load script?
Hi Stefan,
I created these text boxes in a new, empty file, without any script and no variables. This is all there is, in the content of Main tab:
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;($#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
SET FirstWeekDay=0;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='en-US';
It's QV 12 by the way.
After I posted the content of tab Main I realized the value of [Set BrokenWeeks] might cause the problem. After I changed the value of [Set BrokenWeeks] to 0 the output of Week() is correct, according to ISO 8601.
For future reference, these are the settings:
Set BrokenWeeks=0; //(use unbroken weeks)
Set BrokenWeeks=1; //(use broken weeks)
swuehl thanks for replying.
check this Redefining the Week Numbers
Hi Settu,
Thank you, following your link I changed variables to, according to ISO 8601.
SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;