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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ashton_Quincey
Frequent Visitor

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 1
v-yiruan-msft
Community Support
Community Support

Hi @Ashton_Quincey ,

You can refer the following links to get it:

Exclude weekends and holidays:

DAX:

networking days excluding holiday and weekend

WorkingDaysCount = 
// Assuming weekend is Sat & Sun .... adjust if required
CALCULATE (
    COUNTROWS ( 'WorkDate' ),
    FILTER (
        'WorkDate',
        NOT ( 'WorkDate'[WeekDay] IN { "Sat", "Sun" } )
            && RELATED ( Holidays[Date] ) = BLANK ()
    )
)

Power Query:

Working hours without Holidays, weekends and by country in power query

 

Exclude non-working hours:

Power BI calculating time difference excluding weekends and non working hours

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.