Forum Discussion

HenryJS's avatar
HenryJS
Post Prodigy
5 years ago
Solved

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,

  • Anonymous's avatar
    Anonymous
    5 years ago

    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

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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

  • 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 

  • HenryJS , if data type is time

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

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

      • PhilipTreacy's avatar
        PhilipTreacy
        Super User

        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.