Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
joshrussin
Contributor III

Current work days in month

Trying to calculate the amount of work days in the current month.

I need to account for the weekends and holidays. I currently have a string variable with all of my selected holidays defined as 'vHolidays'.

Here is the expression I am trying to use to achieve said count. The current amount of days for this month would be 20, 4th of july.

=networkdays({$<Date={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Month = {"$(=Month(Today()))"}>} min(Date), max(Date))

1 Solution

Accepted Solutions

Re: Current work days in month

You want it for the whole month... try this

=NetWorkDays(MonthStart(Max(Date)), MonthEnd(Max(Date)), $(vHolidays))

10 Replies

Re: Current work days in month

I think it should be like this:

=NetWorkDays(MonthStart(Max(Date)), Max(Date), $(vHolidays))

joshrussin
Contributor III

Re: Current work days in month

Used for formula, result was 5.

Changed the first max to min and result was 27.

there are 31 days in this month, only need to count business days and account for holidays. result should be 20

Re: Current work days in month

You want it for the whole month... try this

=NetWorkDays(MonthStart(Max(Date)), MonthEnd(Max(Date)), $(vHolidays))

joshrussin
Contributor III

Re: Current work days in month

Thanks!

joshrussin
Contributor III

Re: Current work days in month

Hey Sunny,

Any idea as to why this would now return 23 days?

Same formula, just now returns 23 instead of 20.

There are 23 workdays next month. but not sure why it would return next months result

Re: Current work days in month

Check this guy

Max(Date)

Does this give you July or August?

joshrussin
Contributor III

Re: Current work days in month

It returns 8/1/2017

Re: Current work days in month

So, I guess that is your issue, how are you getting 8/1/2017 to be your max date? Do you not expect that?

joshrussin
Contributor III

Re: Current work days in month

I would expect the max date to be the latest date. Which is 7/31/2017. I do not know how it is getting 8/1/2017