The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
How calculate the difference time between 11:54:00 PM and 12:09:00 AM in power bi?
Solved! Go to 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])
Change the format of the column from text to datetime.
Diff = DATEDIFF([LongTime1],[LongTime2],MINUTE)
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.
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)
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])
Change the format of the column from text to datetime.
Diff = DATEDIFF([LongTime1],[LongTime2],MINUTE)
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.
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
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
7 |