Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Generating sequence number

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

Generating sequence number

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

Not applicable

Generating sequence number

what did you do?

Not applicable

Generating sequence number

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

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

Not applicable

Generating sequence number

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

Community Browser