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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Nagaraju_KCS
Specialist III
Specialist III

week Number

I have requirement, i want to show month wise week number  w1,w2,w3,w4,w5

It should be start with Week 1, Week 2... and so on

please see this also..Date Functions

without using any macro....

Example:

Feb Month 2016

MondayTuesdayWednesdayThursdayFrydaySaturdaySunday                      
25
26
27
28
29
30
31
(Jan)
01020304050607Week number 1
08091011121314Week number 2
15161718192021Week number 3
22232425262728Week number 4
29Week number 5

Any suggestions ?

1 Solution

Accepted Solutions
ThornOfCrowns
Specialist II
Specialist II

Presuming that having two week 4's is a typo and borrowing the answer from this question:

Monthly week number !

Try

if((week(Date) - week(monthstart(Date)) + 1)<1,1,(week(Date) - week(monthstart(Date)) + 1)) as WeekNumberInMonth,

Props to philmywallet for the work!

View solution in original post

4 Replies
ThornOfCrowns
Specialist II
Specialist II

Presuming that having two week 4's is a typo and borrowing the answer from this question:

Monthly week number !

Try

if((week(Date) - week(monthstart(Date)) + 1)<1,1,(week(Date) - week(monthstart(Date)) + 1)) as WeekNumberInMonth,

Props to philmywallet for the work!

Nagaraju_KCS
Specialist III
Specialist III
Author

i found in Community..

i have used this code...

if(month(weekend(data))= month(data),div(day(WeekEnd(data)),7),div(day(Weekend(data,-1)),7)+1)+1 as WeekNumber,


But Feb, 2016 it showing start with Week2,week3,week4 and so on.

My requirement it should start with Week1......

Not applicable

Take Month(DATE) as Month, Weekday(DATE) as Weekday in script... and in report take Month and weekday field as dimension and count(DATE) as expression in chart ...then the report will show the output you want

CELAMBARASAN
Partner - Champion
Partner - Champion

May be you can try the below script

LOAD *, If(Month(Date) = Month(Previous(Date)), if(Week(Date)=Week(Previous(Date)), Peek('WeekNo'), Peek('WeekNo') + 1), 1) AS WeekNo

Resident Calendar;