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

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

Reply
Tahmineh1989
New Member

Time duration in power bi

How calculate the difference time between 11:54:00 PM and 12:09:00 AM in power bi?

 

1 ACCEPTED SOLUTION

Hi, @Tahmineh1989 

 

You can try the following methods.

Column:

LongTime1 = [Date]&" "&[Time1]
LongTime2 = 
Var _lastdate=MAXX(FILTER('Table',[LongTime1]>EARLIER('Table'[LongTime1])),[Date])
Return
IF(_lastdate=BLANK(),BLANK(),_lastdate&" "&[Time2])

vzhangti_0-1688110576534.png

Change the format of the column from text to datetime.

Diff = DATEDIFF([LongTime1],[LongTime2],MINUTE)

vzhangti_1-1688110632240.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Tahmineh1989
New Member

Still, there is the problem. I changed the time format to Number, but it did not work.Still, there is the problem. I changed the time format to Number, but it did not work.

 

 

Hi, @Tahmineh1989 

 

You can try the following methods.

Column:

MINUTE = DATEDIFF([Time1],[Time2],MINUTE)

vzhangti_0-1687748548680.png

Is this the result you expect?

DATEDIFF function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi,

I did what you said. But the value of -1425 is wrong. The duration between 11:51:08 PM on 22 June and 12:06:08 AM on 23 June is 15 min. Why does it show this huge amount?

 

Hi, @Tahmineh1989 

 

You can try the following methods.

Column:

LongTime1 = [Date]&" "&[Time1]
LongTime2 = 
Var _lastdate=MAXX(FILTER('Table',[LongTime1]>EARLIER('Table'[LongTime1])),[Date])
Return
IF(_lastdate=BLANK(),BLANK(),_lastdate&" "&[Time2])

vzhangti_0-1688110576534.png

Change the format of the column from text to datetime.

Diff = DATEDIFF([LongTime1],[LongTime2],MINUTE)

vzhangti_1-1688110632240.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ppm1
Solution Sage
Solution Sage

If the end time is earlier in the (next) day, you can +1 to the difference. This article may have some good other info on working with times/durations in Power BI.

Calculate and Format Durations in DAX – Hoosier BI

Pat

Microsoft Employee

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.