Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to count number of net working days

I need to calculate the "net working days" of employees. The data comes from our punch clock system, users can punch-in and punch-out several times per day - so we can get multiple data records for the same day. The definition for "net working days" would be to count the number of days for which we have any time reports, not counting days, where the employee was either on vacation, on sick leave or had any kind of other absences. Also, days, where e.g. the user had a medical appointment before going to work should not count. All mentioned absences are also listed as records in the same table. I have already created a field where any record which is an absence, receives the count 1, intending to count the number of days where the sum of this field is zero. But I fail to get a total count of days when I do not use the "Date" Dimension in my report.

Here is the expression I tried:

 

if(aggr(sum(AbsenceCount), Date, User) = '0', count(DISTINCT(Date)))

Below an example: what I would like to get back is the count 2 - for two days within the selected date range which are net working days for the user.

UserDateTimeRecord TypeAbsenceCount
John Doe25-April-201408:00AMWork0
John Doe25-April-201402:00PMWork0
John Doe26-April-201408:00AMMedical Appointment1
John Doe26-April-201402:00PMWork0
John Doe27-April-201408:00AMWork0
1 Solution

Accepted Solutions
MarcoWedel

or like this:

=Sum(Aggr(1-Max(AbsenceCount), User, Date))


QlikCommunity_Thread_119122_Pic2.JPG.jpg

QlikCommunity_Thread_119122_Pic1.JPG.jpg

hope this helps

regards

Marco

View solution in original post

4 Replies
Colin-Albert
Partner - Champion

Have you seen the NetWorkDays() function

http://community.qlik.com/thread/31320

swuehl
MVP

Maybe like

=count({<Date = e({<AbsenceCount = {1}>}) >} DISTINCT Date)

MarcoWedel

or like this:

=Sum(Aggr(1-Max(AbsenceCount), User, Date))


QlikCommunity_Thread_119122_Pic2.JPG.jpg

QlikCommunity_Thread_119122_Pic1.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Brilliant - worked like a charm! Many thanks for your help!