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
JonSwed
Advocate II
Advocate II

Changing seconds into a hh:mm:ss duration

This is doing my head in. 

I want to report seconds in a table as a hh:mm:ss duration rather than just ss.

I've been able to get this far (using the instructions here: https://efficiency365.com/2018/08/31/power-bi-seconds-to-duration/)

JonSwed_0-1608053041797.png

But I cannot get this data to appear in table in the desired format. Any suggestions gratefully accepted.
Thanks!

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

Hi @JonSwed ,

 

The result you displayed is actually correct, because your seconds column is a decimal number, which seems a little strange.As shown in the figure below, both 666 seconds and 666.14 seconds are converted into 11 minutes, and the result is correct. If you don't want to display decimals, you can use rounding to round up and then convert. 

 

#duration(0,0,0,Number.Round([Sec2]))

 

24.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @JonSwed ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

v-stephen-msft
Community Support
Community Support

Hi @JonSwed ,

 

The result you displayed is actually correct, because your seconds column is a decimal number, which seems a little strange.As shown in the figure below, both 666 seconds and 666.14 seconds are converted into 11 minutes, and the result is correct. If you don't want to display decimals, you can use rounding to round up and then convert. 

 

#duration(0,0,0,Number.Round([Sec2]))

 

24.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

Hi, @JonSwed , you might want to truncate milliseconds from [avg_time_on_page] column by adding new column using this formula

#duration(0,0,0,Number.RoundDown([avg_time_on_page]))

 Screenshot 2020-12-15 202449.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.