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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Kudoed Authors