Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
poooja
Creator
Creator

Total Number of weeks in the current month

Hi Qlikies,


My source has sales & budget data so it has order date, Transaction date and budget date. Please help me with some logic for the below scenario .

1. How to find 'Total Number of weeks in the current month'. Week starts from Monday.If the week has started already it should be considered as same week irrespective of the new month start. If the month starts on middle of the week that should consider as last week of the previous month.I am able to achieve but not as desired.

(Answer is: Jan 5 weeks,Feb 4 weeks,Mar 4 weeks,Apr 5 weeks, May 4 weeks,June 4 weeks, July 5 weeks,Aug 4 weeks,Sep 4 weeks,Oct 5 weeks,Nov 4 weeks,Dec 5 weeks,)

Result what i am getting is : Feb 5 weeks, March 6 weeks but it should be 1 week less because Feb 1 false under last week of January and march 1 falls under last week of Feb.

2. Max(OrderDate) falls in which week of the current month.
Ex: if OrderDate 3/1/2019 this is falls in 4th week of Feb.

I have attached the QVW. It has master calendar in it.

Thanks!

Pooja

4 Replies
Claudiu_Anghelescu
Specialist
Specialist

 
To help community find solutions, please don't forget to mark as correct.
poooja
Creator
Creator
Author

Hi Claudiu,

I am looking  for tthe solution as below.  

WeekNumberDayDate
1Friday1/4/2019
2Friday1/11/2019
3Friday1/18/2019
4Friday1/25/2019
5Thursday1/31/2019
1Friday2/8/2019
2Friday2/15/2019
3Friday2/22/2019
4Thursday2/28/2019
1Friday3/8/2019
2Friday3/15/2019
3Friday3/22/2019
4Sunday3/31/2019
Claudiu_Anghelescu
Specialist
Specialist

=WeekDay(LinkedDate)

 

To have "Friday" instead of "Fri" change this in Main Script.

FROM :    SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

TO:           SET DayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';

To help community find solutions, please don't forget to mark as correct.
poooja
Creator
Creator
Author

Hi,

Your output is not matching my expectations. for example in February your output has 5 weeks. But i am expecting only 4 weeks. where i consider 02/1/19-02/8/19 .

Thanks!

Pooja