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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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