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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Arranafc19
Helper IV
Helper IV

Calulcate Total Time difference between two datetimes

Hi ,

 

I am working on a measure which calculates the total time difference between datetime columns in power bi.

 

I am using the below custom column to get this but my issue is that this creates a text type column which will not allow me to sum.

 

=Duration.ToText([AlarmClearedUTC]-[AlarmSentUTC])

 

Is there a way to get the time difference between datetimes which will then allow me to sum this up in a measure ?

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Arranafc19 ,

 

You can use "datediff" function for calculation.

 

Here is the reference:

https://dax.guide/datediff/

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Arranafc19 ,

 

You can use "datediff" function for calculation.

 

Here is the reference:

https://dax.guide/datediff/

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
harshnathani
Community Champion
Community Champion

Hi @Arranafc19 ,

 

 

You can try these solutions

 

https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

https://community.powerbi.com/t5/Desktop/Calculate-Hours-between-dates-for-only-business-hours/td-p/...

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.