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

Calculating Working days after user selection of a month

Hi,

I need to calculate the Working Days in a month selected by the user.

I know that the function networkdays(start_date,end_date) does that, but I think I would need to calculate the start date and end date of the selected month and pass them as parameters to the networkdays function.  I also know that I can use the MonthStart and MonthEnd functions.  What I don't know is how to perform this after the user has selected a month in a multibox object.

Thanks,

wgonzlez

1 Solution

Accepted Solutions
MayilVahanan

Hi,

     Use like this,

     =MonthStart(Min(Date)) and MonthEnd(Max(Date)) as the parameters to the networkdays

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

Hi,

     Use like this,

     =MonthStart(Min(Date)) and MonthEnd(Max(Date)) as the parameters to the networkdays

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable

Hello!!

My suggestion will be to add a dimension for those dates flagging the working days as 1, and then do a count (or sum if you use the flag as the number 1) for the selection period

Sum({<WorkingDayFlag = {1}>}FieldToAggregate)

Count({<WorkingDayFlag = {1}>} SelectedPeriod)

On you load script you can go like this
if(Weekday(date) = 'Mon' or Weekday(date) = 'Tue' or Weekday(date) = 'Wed' or Weekday(date) = 'Thu" or Weekday(date) = 'Fri",1,0) as WorkingDayFlag
Every working day will be associated to a 1 value

Hope this helps, I have to run to a meeting so I will calrify if needed
Regards,

wgonzalez
Partner - Creator
Partner - Creator
Author

Thank you guys!  I used Mayil's suggestion, since it's a shorter way.  Thank you both!