Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Why does the function week return 53 for the date 01.01.2010????
regards,
MT
sure, if(week(SomeDate)=53,52,week(SomeDate))
1/1/2010 was on a Friday. I guess that Qlikview interprets that as being in the last week of 2009.
I believe QV uses ISO 8601 for its date and calendar functions:
http://en.wikipedia.org/wiki/ISO_8601
So week 53 is correct for that date. [Check also the weekyear(DATE) function.]
Regards,
Stefan
Stefan is correct.
Basically there are two parameters when calculating week numbers:
Today, QlikView only supports the ISO standard for both these bullets (hard-coded in the product).
HIC
hm...is there anyway i could make the 53 to a 52??? cause like that the chart i created is not really readable.
regards,
MT
sure, if(week(SomeDate)=53,52,week(SomeDate))
You should use
week( Date ) -1
in order to differenciate the two consecutive last weeks.
If you want to redefine the Week numbers altogether, you can use
Div(date-YearStart(date)+WeekDay(YearStart(date))+7,7) as WeekNumber
This will always return week 1 for Jan 1st. It will use Monday as the first day of the week. If you want Sunday as the first day of the week, you should use
Div(date-YearStart(date) + WeekDay(YearStart(date)+1) +7,7) as WeekNumber
HIC
Hi Henric- I have the opposite problem, it is interpreting 12/30/2013 & 12/31/2013 as week 1.
And I need them to be week 53.
Is it possible to correct this in the script?
The above formula
Div(date-YearStart(date) + WeekDay(YearStart(date)+1) +7,7) as WeekNumber
will return 53 for 12/30/3013.
Which type of week number do you want? I assume that it is the type "6/1/1" in the chart below (Week numbers are numbers with colored background.). If so you can use the above formula.
HIC