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
cmiller1221
New Member

Using DATEDIFF to calculate (hh:mm)

I am trying to find the difference in time down to the hour and minute. Here is an example of some of the data.

 

cmiller1221_1-1594760841952.png

 

 

I cant seem to write a DAX statement that allows me to output the hours and minutes elapsed between the two columns. One problem I am running into with the HOUR feature is that it maxes at 23 hours. Any help would be appreciated. 

 

2 REPLIES 2
amitchandak
Super User
Super User

@cmiller1221 , you date diff between

Date1 - Date2 = it will be in time, more than 24 hours will in day

 

if you try datediff(Date1,Date2,Minute), You need convert into hours and minute using Mod and quotient and display as text

 

https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-usi...

https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389

az38
Community Champion
Community Champion

Hi @cmiller1221 

try smth like

Column = 
var diff = VALUE([ResolvedDate] - [DiscoveredDate])
var h = ROUNDDOWN(24 * diff, 0)
var m = ROUNDDOWN(60* (24 * diff - h), 0)
RETURN
h & "h " & m & "m"

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.

Top Solution Authors