Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
N_avya1
Contributor III
Contributor III

Working Days by month

Hi,@everyone 

I wanted to display total working days by month.

I have used below formula for feb month excluding holidays and weekends but it is displaying wrong value.Can you please help 

=NetWorkDays(MonthStart(Today(),-1),MonthEnd(Today(),-1),DAY_DATE,WeekDay(DAY_DATE)='Sat' OR WeekDay(DAY_DATE)='Sun')&'WD'

Labels (1)
7 Replies
vincent_ardiet_
Specialist
Specialist

NetWorkDays is already removing Sundays and Saturdays.
Then, if you want to remove specific days (holidays), you need to specify each of them, for example:
NetWorkDays(StartingDate,EndingDate,'04-07-2023','23-11-2023') to remove the 4th of July and the 23rd of November.

N_avya1
Contributor III
Contributor III
Author

Hi @vincent_ardiet_  what if we don't know the Exact holidays Date in that case what I have to mention?

Note: I have Holiday Field in my Data

vincent_ardiet_
Specialist
Specialist

If you have holidays in a field of your datamodel, you can try to generate the parameters list, for example:
=NetWorkDays(YearStart(Today()),Today(),$(=Concat({1}Distinct Num(HOLIDAY_DATE),',')))

N_avya1
Contributor III
Contributor III
Author

This Formula is working for yearstart to till today but i wanted to display each and everymonth like January total working days and feb total working days.

vincent_ardiet_
Specialist
Specialist

This was an example.
If you want to do this, you need to be more specific, this is not very clear. What are your fields, tables, in which context are you going to display this?

N_avya1
Contributor III
Contributor III
Author

Sorry About that i have 12 tables which contains from jan to dec each table has Wee,WeekDay,DayOfmonth,WorkingDuration fields. at the bottom of the tables i need display total working Days excluding holiday in text object for each month

vincent_ardiet_
Specialist
Specialist

So you will hardcode 12 expressions right?
Create a variable "MonthlyNetWorkDays" like this:
=NetWorkDays(MakeDate(Year(Today()),$1),MonthEnd(MakeDate(Year(Today()),$1)),$(=Concat({1}Distinct Num(HOLIDAY_DATE),',')))

And then use $(MonthlyNetWorkDays(1)) for Jan networkdays, $(MonthlyNetWorkDays(2)) for Feb...