Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
deepanshu_chamo
Partner - Contributor II
Partner - Contributor II

Calculate Business Hours

Hi Everyone -

I need an help related to Calculate Business Hours. My requirement to calculate the working hours per below hours

Monday 8am to Friday 6pm

@swuehl I have read so many articles from your side. Kindly help

9 Replies
swuehl
MVP
MVP

Hi, I am not sure about your exact requirements, but maybe something like shown in this post might help you.

deepanshu_chamo
Partner - Contributor II
Partner - Contributor II
Author

Thanks @swuehl for your response. I have checked and go through it but it does not work.

I need to calculate the hours starts from 8AM Monday morning to 6 PM Friday evening

which means

Monday :: 8 AM to 12 AM (16 Hours)

Tuesday to Thursday :: 72 Hours ( since shift is rotating for 24 Hours)

Friday :: 12:00 AM to 6 PM (18 Hours )

Please suggest. Thanks a lot in advance

 

deepanshu_chamo
Partner - Contributor II
Partner - Contributor II
Author

Any start and end date must follow those criteria

ToniKautto
Employee
Employee

@deepanshu_chamo I can imagine a couple of different way to accomplish this, but it most suitable option depends on your data table with the working hours. 
Please share a sample QVF of the working hours table that you are aggregating from. 

deepanshu_chamo
Partner - Contributor II
Partner - Contributor II
Author

Thanks @ToniKautto for your response and help!!

Kindly find attached QVF file. We have ID, Close-time and Open-time.

Thanks again

Regards

Deepanshu

 

 

deepanshu_chamo
Partner - Contributor II
Partner - Contributor II
Author

Hi @ToniKautto Kindly let me know if you got the chance to look in to it. Thanks much!!

ToniKautto
Employee
Employee

@deepanshu_chamo I partly misinterpreted the question before, so thank you for the clarifying sample. 

I have been thinking about this scenario, and my main suggestion would be to transform the interval for each incident to one record per date, then calculated the shift time per record. That way your aggregation in visualization becomes a simple Sum()

deepanshu_chamo
Partner - Contributor II
Partner - Contributor II
Author

@ToniKautto Thanks for your response. could you help me to share any formula which I would used in this scenario. Thanks!!

ToniKautto
Employee
Employee

@deepanshu_chamo it's not really a simple formula. I'm suggesting that you model the data in a way that you can use a simple Sum() to aggregate the hours. The principle would be to represent each incident with one record per date and have the adjusted shift hours per-incident and date. 

See attach example. Note, this is not a fully functional sample, as it for example does not cover a scenario where an incident is opened and closed on the same day.
You probably also want to consider some incremental QVD logic to minimize this loop to go through all records at every reload. 

I hope this can help you forward.