Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We all know that a calendar year has 52 weeks. I wonder why Dec 31, 2012 is in "week one" of year "2012"... Have you notice it? How can I fix this issue?
Regards,
Bill
This is because by default the first week of year starts on MONDAY of the first week. If you want 1st Jan as the starting of the week then you have to tweak your code, something like:
Ceil((Date(TempDate)-YearStart(TempDate))/7) as Week
Hi
Use Floor
Week(Floor(TempDate))
Hope that helps
Change the Listbox "Year" to use the field WeekYear (instead of Year) to get UI consistent.
- Ralf
..or maybe better use WeekYear (or WeekName(..)) in the Listbox "Week".
The week numbers in QlikView follow the ISO 8601 definitions. And with these, week one sometimes starts the year before. If you want to define your week numbers differently, you can do this in the script. One example on a script that does this can be found in the following blog post: Ancient Gods and Modern Days
HIC
Above table box you can notice that they are interchanged week no.
Jan 1 should be week1, and Dec 31 should be week52
You can use LunarWeekName
To get WeekNo you can use
=SubField(LunarWeekName(FieldName), '/', 2)
Hi,
12/31/2012 falls in Year 2013 first week and
1/1/2012 falls in Year 2011 52nd week.
Try like this, calculate week number manually
LOAD
Date
(Date + RowNo()) AS Date,
Ceil(DayNumberofYear(Date(Date + RowNo()))/7) AS Week;
LOAD
YearStart(Today(), -1) AS Date
AUTOGENERATE(800);
Hope this helps you.
Regards,
Jagan.