Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
-----------
12/30 is week 52 (year 2012)
12/31 is week 1 (year 2012)
1/1 is week 1 (year 2013)
So far everything is OK. If you ant to make a year-week field, like 2012w52, you get into trouble. In this case you must make sure that 12/31 gets into the next year, i.e. it goes into week 2012w01.
You can do this "easily" by checking the day and week number to determine if the date belongs to a week in the next year or last year.
Hi Good question,
Try using week function in your date coloumn you will get the answer,
like for example you have two dates say 31-12-2012 and 1-1-2013 then if you will apply week function
it will show week 1 in 2013 year which is correct as 31 dec and 1 jan was Mon and Tue of the week and therefore
it will show 31-12-2012 and 1 jan in week 1 and dates below 31-12-2012 in 52 week .
Regards,
anant
QlikView uses ISO 8601 to calculate week number (See http://en.wikipedia.org/wiki/ISO_week_date)
This means that the week starts on a Monday, and that week 1 is
HIC
I think you need to get rid of the syntetic table to get it to work. There's seems to be something fishy in the links between the calendar and your data.
I think you have managed to somehow duplicate the date throught the syntetic keys. Creating a Table box with Link_Date, YearPeriod2 and Week shows up like this:
%Link_Date | YearPeriod2 | Week |
01/01/2011 | 201101 | 52 |
01/01/2011 | ||
01/02/2011 | 201101 | 52 |
01/02/2011 | ||
01/03/2011 | 201101 | 1 |
01/03/2011 | ||
01/04/2011 | 201101 | 1 |
01/04/2011 | ||
01/05/2011 | 201101 | 1 |
01/05/2011 |
Your sales is linked to the "rows" with no YearPeriod and no Weeks.
Btw. you cannot mix months and weeks in a chart because these are two different date hierarchies.
- Ralf
Just ran into this issue as well. (2012.12.31 was hitting me..)
The solution was/is the function weekyear(date)
Here's the explanation from the help:
<quote>
The year to which the week number belongs. The week number ranges between 1 and approximately 52. Some years week #1 starts in December, e.g. December 1997. Other years start with week #53 of previous year, e.g. January 1999. For those few days when the week number belongs to another year, the functions year and weekyear will return different values.
</quote>
Since I want the format YYYY.WW I used the following, clumsy statement for my weekyear:
weekyear(D)&'.'&if(len(week(D))=1,'0'&week(D),week(D))
Works fine though...
Stefan
I would go for the following instead:
Dual(WeekYear(Date) &'.'& Num(Week(Date),'00'),WeekStart(Date))
Does the same as your expression but the dual puts a numeric value into the field also. Good for comparisons and sorting.
HIC