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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PBI_newuser
Post Prodigy
Post Prodigy

How to exclude holidays and weekends in the hours calculation

Hi,

I have difficulty in calculating the hour different for the below 4 scenario.

  1. If End date fall on holiday, exclude it and revise the end date to the latest working hour of the day (11:59:59 PM).
  2. If Start date fall on holiday or weekend, exclude it and revise the start date to 12:00:00AM of the next working day.
  3. If End date fall on weekend, exclude it and revise the end date to the latest working hour of the day (11:59:59 PM).
  4. If there is no working day between start and end date, calculate the different hours between the 2 dates.

Below is an example and "Different in hours" is the expected output.

ScenarioPO NumberStart DateEnd DateRevised Start DateRevised End DateHolidaysWeekend Different in hours
Scenario 1PO-0151720602-07-20 16:3606-07-20 14:00 02-07-20 23:593rd & 6th Jul4th & 5th Jul7.4
Scenario 2PO-0152026505-07-20 12:2106-07-20 13:4506-07-20 0:00 6th Jul5th Jul13.7
Scenario 3PO-0164108409-10-20 17:5010-10-20 16:30 09-10-20 23:59 10th Oct6.2
Scenario 4PO-0164906317-10-20 3:0818-10-20 16:00   17th & 18th Oct36.9

PBI_newuser_0-1613457335675.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PBI_newuser , refer if this blog on business hour can help you

https://exceleratorbi.com.au/calculating-business-hours-using-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@PBI_newuser , refer if this blog on business hour can help you

https://exceleratorbi.com.au/calculating-business-hours-using-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.