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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Novice_92
Frequent Visitor

Converting whole number to duration

Hi all,

 

I'm in the process of building a dashboard, part of which will detail how long a user has been in various states, ACD, ACW etc.

 

Current data type is whole number for time (seconds) and I'm looking for a way to convert this into hours, minutes & seconds and for this not to be converted into days when 24 hours is hit.

 

Any help would be much apperiated.

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Novice_92 

 

Here is one method with calculated column.

Duration = 
var vHour = INT('Table'[Seconds]/3600)
var vMinute = INT(MOD('Table'[Seconds],3600)/60)
var vSecond = MOD(MOD('Table'[Seconds],3600),60)
return
vHour&":"&vMinute&":"&vSecond

vjingzhang_0-1657697662480.png

 

You can make similar calculations to create a measure or a custom column with Power Query. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Novice_92 

 

Here is one method with calculated column.

Duration = 
var vHour = INT('Table'[Seconds]/3600)
var vMinute = INT(MOD('Table'[Seconds],3600)/60)
var vSecond = MOD(MOD('Table'[Seconds],3600),60)
return
vHour&":"&vMinute&":"&vSecond

vjingzhang_0-1657697662480.png

 

You can make similar calculations to create a measure or a custom column with Power Query. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

arichard19
Resolver I
Resolver I

I would personally do this in Power Query but you can also do it via Calculated Columns or DAX Measures -

When importing the data into Power Query, depending on exactly what date columns it contains, you could use the following PowerQuery MashUp Code functions to convert the seconds into different levels of duration.
https://docs.microsoft.com/en-us/powerquery-m/datetime-functions

You could also just use basic math, and create custom columns in Power Query so that you do exercises such as ->
Minutes = Column[Seconds] / 60 -> Hours = Column[Minutes] / 60 -> Etc...

The same can be done using calculated columns ->
Minutes = Column[Seconds] / 60 -> Hours = Column[Minutes] / 60 -> Etc...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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