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: 
Not applicable

NetWorkDays function

Hello everyone,

For example, I have 2 dates : DateA = 18/12/2014    and     DateB = 13/01/2015       (in format dd/mm/yyyy)

If I do DateB-DateA, I get 26    which is ok.  (31-18) + 13 = 26

If I do NetWorkDays(DateA,DateB), I expect to obtain 18 because between Thursday 18th and Friday 13rd, there are 4 weekends so 8 weekend days, so I should obtain 26-8 = 18.

But I get 19.

Does NetworkDays include DateA and DateB in the count and so is not equal to :  DateB-DateA - number of Sundays &Saturdays ?

Other question:


I would like to add some days in the holiday field. Those days are fixed every year (25th of December, 1st of January) is there a way to tell QV I want those days as holidays without having to write a list of those days for every year in my Qlikview (25/12/2000, 25/12/2001,...25/12/2015...) ?

Thank you for your help

11 Replies
alexandros17
Partner - Champion III
Partner - Champion III

yes the 2 dates are included

Colin-Albert

The start and end days are both included in the networkdays calculation.

This is from the F1 help on networkdays.

networkdays (start:date, end_date {, holiday})

Returns the number of working days (Monday-Friday) between and including start_date and end_date taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

As mentioned above your answer is correct.

NetWorkdays includes the start and end date in calculation of NetWorkDays.

Another example is

=NetWorkDays ('2015-01-19', '2015-01-23')

this should and will return 5 days, hence your

=NetWorkDays ('2014-12-18 ', '2015-01-13') should return 19 for you.

Not applicable
Author

Thank you for your help :

I have another question:


I would like to add some days in the holiday field. Those days are fixed every year (25th of December, 1st of January) is there a way to tell QV I want those days as holidays without having to write a list of those days for every year in my Qlikview (25/12/2000, 25/12/2001,...25/12/2015...) ?


Thanks again

alexandros17
Partner - Champion III
Partner - Champion III

I think it is not possible, at least with the function NetWorkDays.

You could try to use this function to avoid saturday and sunday and then create

another function to remove your holidays

Not applicable
Author

Ok, that's a pity.

Thank you for your answer

alexandros17
Partner - Champion III
Partner - Champion III

Could you please mark the answers ... if you want ....

Thanks

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I think you can have the list of Holidays stored in a variable and just use the variable in the NetWorkday function as this

SET vHolidays = "'20-Jan-2015','03-01-2015','09-01-2015'";

At the start & end of the date for holiday use double quote and single quote

Then in your NetWorkDays function you have

=NetWorkdays('01-01-2015','20-01-2015',$(vHolidays))

Give that a try

Not applicable
Author

Thank you Gabriel.

I know I can do what you suggest. What I would like to do is to specify a date without the year, eg. "25/12" for Christmas without having to write it for each year.