Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Monthly week number !

I've was using the week() function, but that function returns me the week number of the year.

But I've need the monthly week number.

I don't need the complete week, can be incomplete.

Example:

MondayTuesdayWednesdayThursdayFrydaySaturdaySunday                          





0102
Week number 1
03040506070809
Week number 2
10111213141516
Week number 3
17181920212223
Week number 4
24252627282930
Week number 5

Any suggestions ?

Tks !

1 Solution

Accepted Solutions
Not applicable
Author

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

View solution in original post

7 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

maybe you can use:

=week(date) - week(monthstart(date)) + 1

chematos
Specialist II
Specialist II

= week(date) - week(monthend(addmonths(date,-1)))

Not applicable
Author

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

jaguilera
Contributor III
Contributor III

fantastic solution!

thanks

philmywallet
Creator
Creator

Hi

Just tried this and it shows that 1st July 2013 is in week 2, yet it is actually week 1.

Could you clarify.

Thanks

Phil

philmywallet
Creator
Creator


Had to use this to make it correct .....

 

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

sakthi266
Contributor III
Contributor III

Hi,

   This script fails if Weekend ie is 7th.

Eg. If 01st is Sunday and 7th is saturday and system shows this as 2nd week instead of first week. Check this out and let me know.

Regards, 

Sakthivel.S