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
Guenfood77
Frequent Visitor

Incident duration calculation working days and hours

Hi,

I have to calculate the duration of incidents taking into account working, public holidays and time slots.
Monday to Friday: open from 7:30 a.m. to 6:30 p.m.
Saturday: open from 7:30 a.m. to 5:30 p.m.

In my data table, I have my Incident Number, Start Date, Start Time, End Date, End Time columns
And I also have a "Holidays" table which lists the holidays of the year

If I have an incident open on Saturday 04/16 at 8:00 a.m. and closed on Wednesday 04/20 at 5:30 p.m., knowing that Monday 04/18 was a public holiday.
Its duration would be :
For Saturday: 5h30 p.m. - 8h00 a.m. = 9h30
For Sunday: 0 because non-working day
For Monday: 0 because public holiday
For Tuesday: 6h30 p.m. - 7h30 a.m. = 11h
For Wednesday: 5h30 p.m. - 7h30 a.m. = 10h
That is a total duration of 30h30

How can I create the measure to achieve my goals?


Thanks for your help

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Guenfood77 ,

 

This is similar to calculate working hours between two dates.

There are several topics that provided the solution, please take a look.

https://community.powerbi.com/t5/Desktop/Calculating-Working-hours/m-p/374255 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Hour-Breakdown/m-p/625085#M306 

 

Best Regards,

Jay

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

View solution in original post

1 REPLY 1
v-jayw-msft
Community Support
Community Support

Hi @Guenfood77 ,

 

This is similar to calculate working hours between two dates.

There are several topics that provided the solution, please take a look.

https://community.powerbi.com/t5/Desktop/Calculating-Working-hours/m-p/374255 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Hour-Breakdown/m-p/625085#M306 

 

Best Regards,

Jay

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

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.