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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

How to calculate hours and minutes difference from now

Hi

 

I have a table that shows when were our machines data updated in format:
09.10.2020 08:10:22
Now I need a new column that shows hold old this is from now. Since it's 8:51 o'clock atm it should give me value:
00:41:15

Tried this but it gives me wrong values:

Diff = DATEDIFF(TODAY(),'POS LaneCurrentState'[LastTransactionDate],MINUTE)

 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

Try like

Diff = DATEDIFF(Now(),'POS LaneCurrentState'[LastTransactionDate],MINUTE)
or
Diff = DATEDIFF('POS LaneCurrentState'[LastTransactionDate],Now(),MINUTE)
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks this gives me answer in minutes that I can work with but I also need to be able to do this in M code now.
Tried:
Duration.ToText(DateTime.FixedLocalNow - [LastTransactionDate])
but that doesn't work either:

Expression.Error: We cannot apply operator - to types Function and DateTime.
Details:
    Operator=-
    Left=[Function]
    Right=09.10.2020 08:19:19

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.