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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Value need to convert time in Q Editor

Hello Team,

Need help to convert hh:mm:ss format in query editor for cycle duration column (these values are considered as seconds), This column is in text format

gshastri_0-1600070078091.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

An easy way to solve that:

 

Duration.From([Orderid] / 86400)

 

Value need to convert time in Q Editor.PNG

 

Please try.

Aiolos Zhao

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

An easy way to solve that:

 

Duration.From([Orderid] / 86400)

 

Value need to convert time in Q Editor.PNG

 

Please try.

Aiolos Zhao

amitchandak
Super User
Super User

@Anonymous , Try like this

Duration(Number.IntegerDivide(Number.FromText([Cycle:duration]),86400) ,Number.IntegerDivide(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),
Number.IntegerDivide(Number.Mod(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),60),
Number.Mod(Number.Mod(Number.Mod(Number.FromText([Cycle:duration]),86400),3600),60)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

Sorry, I don't understand, have you already got the seconds and need HH:MM:SS or do you need to calculate the seconds?

If you have HH::MM:SS and need to get seconds, Split Column by delimiter :
Then rename columns to HourPart, MinutePart, SecondPart
Then do a calculated column:
[HourPart]*3600 + [MinutePart]*60 + [SecondPart] and call this calculated column Seconds

If you have Seconds and need HH:MM:SS, then use Number.Mod() and Number.IntegerDivide() to do the opposite

[HourPart]= Number.IntegerDivide{[Seconds], 3600)
[Seconds2]= Number.Mod([Seconds], 3600)
[MinutePart]= Number.IntegerDivide([Seconds2], 60)
SecondsPart = Number.Mod([Seconds2], 60)

Then merge columns with : as delimiter.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Greg_Deckler
Community Champion
Community Champion

@Anonymous Well, if it were DAX you could do it this way: https://community.powerbi.com/t5/Quick-Measures-Gallery/Seconds-2-HHMMSS/m-p/195615#M18

 

Should be able to follow a similar technique in Power Query though. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors