Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Time differences in seconds

Hi all,

 

I have a table like this: 

X.dX.tY.dY.t
23/11/201723:59:5824/11/201700:00:03

 

Now what i want to know is the difference in seconds between X and Y. The record above will have an expected outcome of "5" I want the outcome to be a number not for example "00:00:05". 

 

Any suggestions would be great,

 

Thanks in advance!

L.Meijdam 

  • Out of my head:

     

    = Duration.TotalSeconds(([Y.d]&[Y.t])-([X.d]&[X.t]))
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi MarcelBeug

     

    Thanks for providing a solution, it worked like expected.

     

    In the meantime I also figured on a DAX solution although I had to merge my columns to a Date/Time column. After transforming my columns to 2 date/time columns I used this DAX formula. I'll also leave it behind for other people that might seek for a DAX solution.

     

    Column = DATEDIFF(Table1[X.dt];Table1[Y.dt];SECOND)

    Thanks for helping!

     

    Best Regards,

    L.Meijdam

2 Replies

  • MarcelBeug's avatar
    MarcelBeug
    Community Champion

    Out of my head:

     

    = Duration.TotalSeconds(([Y.d]&[Y.t])-([X.d]&[X.t]))
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi MarcelBeug

       

      Thanks for providing a solution, it worked like expected.

       

      In the meantime I also figured on a DAX solution although I had to merge my columns to a Date/Time column. After transforming my columns to 2 date/time columns I used this DAX formula. I'll also leave it behind for other people that might seek for a DAX solution.

       

      Column = DATEDIFF(Table1[X.dt];Table1[Y.dt];SECOND)

      Thanks for helping!

       

      Best Regards,

      L.Meijdam