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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

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 

2 ACCEPTED SOLUTIONS
MarcelBeug
Community Champion
Community Champion

Out of my head:

 

= Duration.TotalSeconds(([Y.d]&[Y.t])-([X.d]&[X.t]))
Specializing in Power Query Formula Language (M)

View solution in original post

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

View solution in original post

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

Out of my head:

 

= Duration.TotalSeconds(([Y.d]&[Y.t])-([X.d]&[X.t]))
Specializing in Power Query Formula Language (M)
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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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