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

[Question] How to calculate the number of working day taken by employee?

Hi all

I have a question on how to calculate the number of working day taken by employee.

Many company has block leave policy - to take 5 working days continuously.

It can be in any combination. e.g.   (Mon, Tue, Wed, Thu, Fri ) , (Thu, Fri, Mon, Tue, Wed) , or (Wed, Thu(public holiday), Fri, Mon, Tue, Wed).

I have a set of data with the following format

staff ID          Leave Date

001                    8/10/2015

001                    8/11/2015

001                    8/12/2015

001                    8/13/2015

001                    8/14/2015

001                    8/25/2015

001                    8/31/2015

001                    9/1/2015

002                    8/14/2015

002                    8/15/2015

002                    8/18/2015

002                    8/25/2015

002                    8/26/2015

002                    8/27/2015

002                    9/7/2015

003                    8/14/2015

003                    8/17/2015

003                    8/18/2015

003                    8/19/2015

003                    8/20/2015

003                    8/25/2015

003                    8/31/2015

003                    9/1/2015

I want to know have an Block leave taken indicator - Y means the staff took block leave, N means not.

in the case above 001 and 003 have block leave indicator - Y while 002 has N

Any assistance is appreciated.

Thanks!

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Calculate the number of working days using

     NetWorkDays(start_date, end_date)

If you want to account for public holidays, you will need to load the dates into a comma separated list of dates (either in numeric format, or as quoted date format). Like this:

     NetWorkDays(start_date, end_date, '2015/06/16', '2015/09/24', ...<more dates>....)


You can construct the holiday list in script into a variable, then use the variable like:

     NetWorkDays(start_date, end_date, $(vHolidays))


Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Appreciated your response.

I am aware the usage of NewWorkDays.

However, the challenge of this question is it's difficult to pick the start date and end date.