Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
agni_gold
Specialist III
Specialist III

Generate Week Numbers as Filed during resident load

I gave a table , contains Week start date and week end date and other columns ,

But i want to load the resident as week numbers also

1

2

3

4

5

6

7

8

9.........

..

..

..

..

52  as Week field.

How can i do that ....

thanks

18 Replies
MarcoWedel

LOAD Week(WeekStartDate) as Week

          WeekStartDate,

          WeekEndDate,

          OtherColumns

From YourDataSource;

MarcoWedel

There are also other helpful functions regarding Weeks:

WeekYear, WeekName

hope this helps

regards

Marco

agni_gold
Specialist III
Specialist III
Author

Thanks for your reply Macro.

I have already used it but problem is that it generates only week start numbers

1

5

9

14

18

22

27

31

36

40

44

49

But i need 1 to 49 series , the data related to week 1 is came for 2,3,4 also .

ecolomer
Master II
Master II

You can generate number from week(01/01/year) to week(31/12/year)

agni_gold
Specialist III
Specialist III
Author

inside load ?

Please give me some script.

ecolomer
Master II
Master II

// -----> 41275 = 01/01/2013

// -----> 41640 = 01/01/2014

Orders:

Load

  date(num(41275) + ceil(RowNo()/3)-1)    as Date,

  RowNo()                                 as OrderNo,

  if(odd(RowNo()),'Ext','Int')            as OrderType,

  if(right(RowNo()*2,1)=2,'Joan','Anna')  as OrderCreator,

  rand() * 1000 as OrderValor

autogenerate 2190;

//------------ FECHAS / Dates

LOAD

  Date as xDate,

  year(Date) as xYear,

  month(Date) as xMonth,

  day(Date) as xDay,

  Num(week(Date), '00') as xWeek,

  'Q' & ceil(Num(Month(Date))/3) as xQuarter,

  'H' & ceil(Num(Month(Date))/6) as xHalf,

  Num(Month(Date), '00')     as xMonthNo,

    MonthName(Date)     as xMonthYear,

    QuarterName(Date) as xQuarterYear,

   

    year(Date)&'-Q'&ceil(Num(Month(Date))/3) as xYearQuarter,

    year(Date)&'-'&Num(Month(Date),'00') as xYearMonth,

   

    WeekYear(Date)&'-'&Num(Week(Date),'00') as xYearWeek,

   

    WeekStart(Date) as xWeekStart,

    WeekEnd(Date) as xWeekEnd,

    WeekYear(Date) as xWeekYear,

   

              

    dual(WeekDay(Date),num(WeekDay(Date))) as xWeekDay

resident Orders;

ecolomer
Master II
Master II

This script have other fields but I think is good for you

ecolomer
Master II
Master II

This is the QV file, with another elements

MarcoWedel

you probably need a calendar table.

Maybe this helps:

tabWeekCalendar:

LOAD *,

      Week(MakeWeekDate(2014, IterNo())) as Week,

      WeekYear(WeekDate) as WeekYear,

      WeekName(WeekDate) as WeekName;

LOAD MakeWeekDate(2014, IterNo()) as WeekDate

AutoGenerate 1

While IterNo() <= 52;

QlikCommunity_Thread_131315_Pic1.JPG.jpg

regards

Marco