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
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
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.