Discussion Board for collaboration on QlikView Scripting.
How to create a sequence number for the Weeks available in calendar table from start to end date....
Calendar dimension have 2 years(2010 and 2011) of data and I need to generate the week number for these years...
Week numbers of 2010 will be from 1 to 52...for 2011 it should be start from 53... So week numbers of 2011 should be 53-104...
i you can try to use the autonumber() like autonumber(year(date) & week(date), 1) AS WeekSerial. If the sorting of year and weeks fits, this should work as you want it.
But week number is not starting from 1 and also it is not in sequence
what did you do?
Already I have CalendarWeek in my Calendar qvd...but start from W01 for each year
So I have used autonumber(CalendarWeek,1)....
autonumber gernerates for every new input a unique number. If the input is for ex. year + week in correct order it is working fine.
Check out my little example code in a new, empty application:
Load *, Year(MyDate) AS MyYear, Week(MyDate) As MyWeek, AutoNumber(Year(MyDate) & Week(MyDate)) AS MyWeekSerial;load date(today() +RecNo()) AS MyDateAutoGenerate(400);
Year(MyDate) AS MyYear,
Week(MyDate) As MyWeek,
AutoNumber(Year(MyDate) & Week(MyDate)) AS MyWeekSerial
date(today() +RecNo()) AS MyDate