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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Convert number to time format

I am trying to convert a column to time format. The minutes in the column REPLY_TIME_IN_CALENDAR_MINUTES are in data type Decimal Number. 

The number I trying to convert is 4805 which should be 80h:5m:0s or 3d:8h:5m but I am getting everything correct except the days. 

 

See image avg reply time.png

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi @Anonymous ,

Please, find the options below:

In case of calculated columns:

d:h:m = 
VAR currentNum = 'T'[Minutes]
RETURN
INT(currentNum/1440) & ":" &                         
RIGHT("0" & INT(MOD(currentNum/60,24)),2) & ":" &    
RIGHT("0" & INT(MOD(currentNum/1,60)),2) 
hh:mm:ss = 
VAR currentNum = 'T'[Minutes]
RETURN
RIGHT("0" & INT (currentNum/60),2) & ":" &           
RIGHT("0" & INT(MOD(currentNum,60)),2) & ":" &          
RIGHT("0" & INT(MOD(currentNum,1)),2) 

If you need a measure, then replace 

var currentNum = 'T'[Minutes]
with 
var currentNum = SELECTEDVALUE('T'[Minutes])
 
Did I answer your question? Mark my post as a solution!

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

7 REPLIES 7
ERD
Community Champion
Community Champion

Hi @Anonymous ,

Please, find the options below:

In case of calculated columns:

d:h:m = 
VAR currentNum = 'T'[Minutes]
RETURN
INT(currentNum/1440) & ":" &                         
RIGHT("0" & INT(MOD(currentNum/60,24)),2) & ":" &    
RIGHT("0" & INT(MOD(currentNum/1,60)),2) 
hh:mm:ss = 
VAR currentNum = 'T'[Minutes]
RETURN
RIGHT("0" & INT (currentNum/60),2) & ":" &           
RIGHT("0" & INT(MOD(currentNum,60)),2) & ":" &          
RIGHT("0" & INT(MOD(currentNum,1)),2) 

If you need a measure, then replace 

var currentNum = 'T'[Minutes]
with 
var currentNum = SELECTEDVALUE('T'[Minutes])
 
Did I answer your question? Mark my post as a solution!

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

@ERD Is there a way to get a sum or an average of that measure? Since that is text I can't get a good measure by that. 

ERD
Community Champion
Community Champion

@Anonymous ,

Work with minutes and then convert to the needed format.

E.g.: var avgMinutes = AVERAGE('number to time format'[Minutes])

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Brilliant!
Thanks!

amitchandak
Super User
Super User

@Anonymous , Try like

 

time([REPLY_TIME_IN_CALENDAR_MINUTES]/60, trunc(mod([REPLY_TIME_IN_CALENDAR_MINUTES],60),0), ([REPLY_TIME_IN_CALENDAR_MINUTES] -trunc([REPLY_TIME_IN_CALENDAR_MINUTES],0))*100/60)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Does not give me the what I need.. 

Jakob_Andersson_0-1618324951566.png

 

@Anonymous , not able to get an issue with screenshot.

Can you share sample data and sample output in table format?

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.