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

Working Days calculation

Dear Experts,

I would like to calculate working days by select date range and need to exclude holidays.

i found networkdays function to calculate, however, i don't know how to exclude holidays list from this function. 

networkdays (startdate, enddate,holiday date)

Please help .

 

Thansk.

1 Reply
SergeyMak
Partner Ambassador
Partner Ambassador

If you want to use the networkdays() function you can read more about it in help

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/DateA...

This example also shows how to use it.

networkdays ('19/12/2013', '07/01/2014', '25/12/2013', '26/12/2013', '31/12/2013', '01/01/2014')

For holidays You should specify start and end of holiday period. In the example above there are two holiday periods

'25/12/2013', '26/12/2013'

and '31/12/2013', '01/01/2014'.

 

Although you can simply use your Master Calendar in order to calculate the all of that.

You will need to add a field to define work days. eg you can use if(Match(Weekday(Date),'Sun.','Sat.'),0,1) - the exact day names you can get from DayNames variable defined in the beginning of Load script.

Before that You can load list of public holidays and using join or applymap also use it in the if statement above.

Basically you will just create a flag=1 when it's Mon-Fri and not public holiday.

After that you can simply do Count(_Flag_WorkDay) to get the number of days

 

Although it depends on your data model

 

Regards,
Sergey