Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ajith_qlik
Contributor II
Contributor II

Issues calculating Working hours for a week for a month

Team,

Iam running into an issue with calculating working hours for all weeks in all month for a year. Its like I need to calculate the total hours worked by an employee excluding weekend , excluding National holidays and excluding Personal Time Off and need to calculate this weekly. The total hours worked by employee per week is always 40 hrs = 5 weekdays * 8hrs. So for example when an employee takes one leave in a week and also if there is one national holiday coming in the same week, it would be 40hrs - 8hrs for Personal time off - 8 hrs for National Holiday = 24hrs for that week. This 24hrs is the result for that employee Iam looking for, for that week. For the next week might be the same employee works for the entire 40 hrs, so the first week of month the employee worked 24 hrs and 2nd week he worked 40 hrs and so on. Any leads to this would be highly appreciated.

Regards

Ajith

Labels (1)
3 Replies
Kushal_Chawda

Please share sample data with expected output . To start with refer to below link. You can consider Personal off as a holiday

Working-Hours-Calculation-excluding-weekends-and-holidays

ajith_qlik
Contributor II
Contributor II
Author

Thanks Kush.. But somehow this is not meeting my requirement. I need the bifurcation of hours for each week in a month.

Note:- Here we are considering only 5 days in a week and excluding weekends, holidays and Leaves. 

I completed the initial bit of requirement of calculating the total hours for a resource for a month on the frontend instead of the load script editor with a different logic (sorry cant post that due to code restrictions). But when Iam using the Date Picker Extension and selecting the week for that month, its not filtering the overall hours i.e. if there are 22 working days for an employee (and employee has not taken any leave or neither a holiday exist), its equal to 22*8 = 176 hrs. So when Iam using date Picker and filtering for one week randomly, its not filtering and giving me 176 hrs instead of 40 hrs (as in entire month employee has not taken any leave neither a National Holiday exist).

Note:- I need the logic for frontend rather than on Load script editor.

Month-Jul (Standar working Hours per week = 8hrs*5Days = 40hrs
Data for First Week -> ResourcePersonal Time Off (from a different table)National Holiday(from a different table)Total Hours in first week
  Emp1Tue Mon(5-2) days * 8hrs = 24 hrs
  Emp2Tue Mon(5-2) days * 8hrs = 24 hrs
  Emp3Wed and ThursMon(5-3) days * 8hrs = 16 hrs
Kushal_Chawda

Without looking into your expression of total hour it will be difficult to tell what is wrong. Probably you can create s sample with dummy data and share.