Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Remove Non-Business Hours from time duration

I'm still new to Power BI and DAX calculations so bare with me if this is a rookie question.

 

We receive cases at any time during any day of the week. Our team works 24x5 so we should be able to cover all week days. However there are some regions/countries that have specific business hours and our team is being penalized for when we receive a case during non-business hours.

 

Below are the business hours base on our teams coverage.

 

EMEA: Monday at (00:30 UTC) to Saturday at (00:00 UTC) 

APJ: Monday at (00:30 UTC) to Saturday at (00:00 UTC)  

United States: Monday - Friday (13:00 UTC - 22:00 UTC)

Canada: Monday at (00:30 UTC) to Saturday at (00:00 UTC) 

Latin America: Monday - Friday (11:00 UTC - 21:00 UTC) 

 

I have created a custom column that shows the time duration of [timestamp_case_completed]-[timestamp_case_created]. If any of those cases are created during non-business hours, I would like for those non-business hours to be removed from the duration as our team is not able to work those cases.

 

In my head, I'd imagine it be something like: (please excuse the elementary calculation)

 

IF[region] = EMEA then remove (Saturday 00:00 UTC to Monday 00:30 UTC)  from [timestamp_case_completed]-[timestamp_case_created].

IF[country] = United States then remove (22:00 UTC - 13:00 UTC M-F and Saturday,Sunday) from [timestamp_case_completed]-[timestamp_case_created].

IF[region] = LATAM then remove (21:00 UTC - 11:00 UTC M-F and Saturday,Sunday)  from [timestamp_case_completed]-[timestamp_case_created].

 

I am not sure how to go about this considering we have weekend and non-business hours on weekdays.

 

Any help would be greatly appreciated on this. I've watched videos on YouTube but none go in depth on this level for me.

1 Reply