Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Working hours calculation is essential measure which is useful in many business cases. In this post I am going to demonstrate the steps to calculate this measure. I have also covered other aspects related to working hours like overtime hours and excluding lunch break hours.
Example in this post works for weekends as Saturday and Sunday. If you have any other weekends then refer to my below post
Working-days-and-hours-calculations-for-custom-weekends
Consider the below case
Let's say one Ticket is logged into the system on certain day , call it as Start Date, and the same Ticket got resolved on certain day, call it as End Day. Now we may want to calculate the working hours between these two Dates to calculate the efficiency of ticket closure time.
1) Calculate business working hours excluding week ends(Saturday and Sunday) and Holidays.
Below are the considerations
1) Count only standard working hours ( 9 AM - 6 PM)
2) Exclude Saturdays and Sundays
3) Exclude Holidays
Below is the Setup in QlikView
You can change the Date format of the below variables as per your convenience eg. 'DD/MM/YYYY hh:mm:ss' to 'DD-MMM-YYYY hh:mm:ss'
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss';
First, convert your Timestamp date format to 24 hour format using the below functions
a) Timestamp# () (if your Timestamp values are text)
b) TimeStamp () (If your Timestamp values are in proper Timestamp format)
Now you can setup the below variables for standard working hours in weekdays.You can change the Variable according to your working hours (Here 9 AM - 6 PM) and rest calculation will be done automatically
Now Setup the Holiday list as below. You can use your own holiday list
Below is the logic to calculate the business working hours between to dates
Here is the output
2) Calculate business working hours excluding week ends(Saturday and Sunday), Lunch Breaks and Holidays.
Below are the considerations
1) Count only standard working hours ( 9 AM - 6 PM)
2) Exclude Saturdays and Sundays
3) Exclude Lunch Break (1 PM - 2PM)
4) Exclude Holidays
Set the Variables for standard working hours and lunch breaks. You can change the values according to your needs
Include the Holidays
Below is the logic to calculate the business working hours between two dates
Here is the output
If you want to present the working hours in hh:mm:ss format then you can use below logic after calculating working hours
=interval(Working_Hours/24,'hh:mm:ss')
Please see the attached QVW.
Feel free to provide any suggestions.
Super Kushal. Good work keep it up.
Thanks Jagan
Nice
Super complicated, but super duper useful. Thanks Kush for sharing this.
Best,
Sunny
Thanks sunny
Thanks k kumar.
Good work, thanks.
Excellent Post Kushal . . .
Good Work, thanks for sharing
It Looks Fantastic.. Thanks!