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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HenryJS
Post Prodigy
Post Prodigy

Calculate difference between two times? In HH:MM:SS

Hi all,

 

How do I calculate the difference between two time columns?

 

Both columns are in HH:MM:SS and I would like the difference column to be the same.

 

 

thanks,

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @HenryJS,

Perhaps you can try to convert your time value to total second(numeric) then you can simply use math operator to calculate on converted values.

For duration and time value transform, you can take a look at the following blog:

Aggregating Duration Time 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @HenryJS,

Perhaps you can try to convert your time value to total second(numeric) then you can simply use math operator to calculate on converted values.

For duration and time value transform, you can take a look at the following blog:

Aggregating Duration Time 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@HenryJS , if data type is time

 Time diff = [time1] -[time2] //diff in time

diff = datediff([time1] ,[time2],hour) // hour ,min or sec etc

 

@amitchandak 

 

Time diff = [time1] -[time2]

 

doesn't work - please see below

 

 

 Capture.PNG

Hi @HenryJS 

Assuming FF Hours 2 is your end time and Engage Hours per day 2 is your start time, try this

 

=Table1[FF Hours 2]-Table1[Engage Hours per day 2]

 

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @HenryJS 

In Power Query create a new Custom Column and subtract one from the other

#"Added Custom" = Table.AddColumn(#"Changed Type", "Difference", each [End]-[Start])

Phil 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy  unfortunately the time columns are DAX columns

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.