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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bsharp
Frequent Visitor

Converting number to a time again

Can someone help me conver this data to a time? 

 

bsharp_0-1612890059049.png

I need the TrnTime to be in HH:MM:SS:MS

 

I tried to modify this but I'm not having much luck. 

 

bsharp_0-1612893466649.png

 

 

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

HI @bsharp ,

 

You can try this

 

HHMMSS = 
INT(Table[TimeSpent] / 3600) & ":" &
RIGHT("0" & INT((Table[TimeSpent] - INT(Table[TimeSpent] / 3600) * 3600) / 60), 2) & ":" &
RIGHT("0" & MOD(Table[TimeSpent], 3600), 2)

 

You can also have a look at this article

https://gist.github.com/jongio/5b8dcf13ab957cecfec3932a42db0e58

https://community.powerbi.com/t5/Quick-Measures-Gallery/Milliseconds-Duration/m-p/406698

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

2 REPLIES 2
VijayP
Super User
Super User

@bsharp 

Use Column From Example in Power Query and give few examples like 9:10:11:12 and 11:12:10:09 to get the resulte and then change the data type




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


harshnathani
Community Champion
Community Champion

HI @bsharp ,

 

You can try this

 

HHMMSS = 
INT(Table[TimeSpent] / 3600) & ":" &
RIGHT("0" & INT((Table[TimeSpent] - INT(Table[TimeSpent] / 3600) * 3600) / 60), 2) & ":" &
RIGHT("0" & MOD(Table[TimeSpent], 3600), 2)

 

You can also have a look at this article

https://gist.github.com/jongio/5b8dcf13ab957cecfec3932a42db0e58

https://community.powerbi.com/t5/Quick-Measures-Gallery/Milliseconds-Duration/m-p/406698

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.