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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kraftchem
Regular Visitor

Calculating Time between dates

Case: I have two date/time fields in Power BI and I am trying to calculate the difference between them. I would like this result to include both days between and time between. The fields I am referring to reside in the ORDHFILE and the columns are Ordrem3 (start time) and Ordrem4 ( end time).

 

Problem: I can create a measure that calculates the days between and the time between but I cant seem to account for working days or working hours only. I have uploaded our holiday table from chempax, created a relationship with the date table you created and been able to create measures for both working days and holiday days. However, I get stuck there and I still cant seem to tie all of that together to achieve my desired result. Below is an example of what we would like the formula to accomplish:

 

Example: BL 111111 has start date of 7/17/2017 4:25 PM and end date of 7/24/2017 1:01 PM

 

The result should be 5 working days and 5 hours and 36 working minutes ( assuming an 8am-5pm work day)

 

**NOTE: Ideally we would like to set the work day based on the employee as some work 7am-4pm etc. **

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

Take a look at the techniques here:

 

http://community.powerbi.com/t5/Desktop/Aggregating-Duration-Time/m-p/13350/highlight/true#M3358

 

I'm thinking using a DATEDIFF with SECONDS and then converting it back to day/time format.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors