Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Generating sequence number

Hi,

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...

5 Replies
Not applicable
Author

Hi shans,

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.

HtH

Roland

Not applicable
Author

But week number is not starting from 1 and also it is not in sequence

Not applicable
Author

what did you do?

Not applicable
Author

Already I have CalendarWeek in my Calendar qvd...but start from W01 for each year

So I have used autonumber(CalendarWeek,1)....

Not applicable
Author

OK,

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 MyDate

AutoGenerate(400);

RR