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: 
QlikAngel
Partner - Creator
Partner - Creator

Monthwise Week

Hello,

I need Monthwise week seperation.

e.g

in Aug month as per calendar, it should display 6 weeks

as Week1, week2 and so on...

So how to do that ?

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Something like below?


Let vMinDate = Num(YearStart(Today()));

Let vMaxDate = Num(YearEnd(Today()));

Date:

Load

  Date,

  WeekDay(Date) as Day,

  If(Date = MonthStart(Date),1) as Week;

Load

  Date($(vMinDate) + IterNo() - 1) as Date

AutoGenerate 1

While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);

Final:

Load

  Date,

  Month(Date) as Month,

  Year(Date) as Year,

  If(Week=1, Week,

  If(Day = 'Mon', RangeSum(Peek('Week'),1),Peek('Week'))) as Week

Resident Date

Order By Date;

Drop Table Date;

View solution in original post

7 Replies
parthakk
Creator II
Creator II

sorry 6 weeks in Aug month???

MK_QSL
MVP
MVP

Something like below?


Let vMinDate = Num(YearStart(Today()));

Let vMaxDate = Num(YearEnd(Today()));

Date:

Load

  Date,

  WeekDay(Date) as Day,

  If(Date = MonthStart(Date),1) as Week;

Load

  Date($(vMinDate) + IterNo() - 1) as Date

AutoGenerate 1

While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);

Final:

Load

  Date,

  Month(Date) as Month,

  Year(Date) as Year,

  If(Week=1, Week,

  If(Day = 'Mon', RangeSum(Peek('Week'),1),Peek('Week'))) as Week

Resident Date

Order By Date;

Drop Table Date;

QlikAngel
Partner - Creator
Partner - Creator
Author

Hi,


Thanks for the help.

I have applied same logic in my application but I am getting multiple weeks instead of 6 weeks as per your script.

Please check the attached application as its not worked... please help @ manish !

Thanks in advance,

Mayuri.

MK_QSL
MVP
MVP

You have to use WeekNum as your final Week Field... Not Week !

QlikAngel
Partner - Creator
Partner - Creator
Author

Hello,

I have also done using week, but still its giving multiple week.

Thanks ,

Mayuri

MK_QSL
MVP
MVP

Upload the file after running the script. I am unable to see WeekNum

QlikAngel
Partner - Creator
Partner - Creator
Author

Thanks Manish... There was Date Problem