11 Replies Latest reply on Apr 30, 2020 2:04 PM by Leonardo Vilano

# Convert Minutes field to Hours:Minutes

I have a column which has minutes data and I want to convert it to hours and minutes.

I tried dividing with 60 but the decimal part of the hours doesnt give the accurate data.

Any suggestions?

• ###### 1. Re: Convert Minutes field to Hours:Minutes

Try this calculated field: MAKETIME(INT([Mins]/60),[Mins]%60,0)

You can format the field to hh:mm

1 of 1 people found this helpful
• ###### 2. Re: Convert Minutes field to Hours:Minutes

Hi Sanchit,

1) Create a calculated field called HH:MM

Formula: [Field Value in Minutes]/60

2) Right click on the newly created calculated field --> default Properties -->Number Format --> hh:mm

You will get the required O/P

Hope this helps kindly mark this answer as correct or helpful so that it will help others

BR,

NB

2 of 3 people found this helpful
• ###### 3. Re: Convert Minutes field to Hours:Minutes

I tried using your approach but when I convert 638 minutes into hours it shows 10:63hrs. The correct result should be 10 hrs and 38 mins. Do you have any idea how this can be resolved?

• ###### 4. Re: Convert Minutes field to Hours:Minutes

This did not work for me. I must be doing something wrong. I am trying a simple calculation for 47,044 minutes. Duration is a Measure. I created a calculated field call Hours. When I use (Duration/60), the result is 784.07. When I change the calculated field to hh:mm, I get 01:36. I am not sure what I did wrong. Thanks, Mark

• ###### 5. Re: Convert Minutes field to Hours:Minutes

What result are you expecting?

• ###### 6. Re: Convert Minutes field to Hours:Minutes

Thank you for the reply. I want the result in hh:mm = 784:04

• ###### 7. Re: Convert Minutes field to Hours:Minutes

I got the same issue,

I have a columm with a integer minutes numbers ex: 12120 and i need to convert this number to hhh:mm 202:00 but i get 010:00 value

• ###### 8. Re: Convert Minutes field to Hours:Minutes

Also, once the conversion is made, will the normal column total work? So, if the result is 784:04 for several different people, let's say 5 people, will the column total be 3920:20? Thanks for your assistance!

• ###### 9. Re: Convert Minutes field to Hours:Minutes

Hi Mark (and Leonardo),

Both you and Leonardo will probably need to follow this tutorial on adding time.  Time is tricky.  Especially when adding time that's greater than a 24 hour period.  If the total is within 24 hours you're good with standard calc's & sum's.

This blog post by Jonathan Drummey will likely do it:  Formatting Time Durations in Tableau | Drawing with Numbers Please make sure you read all the way through as there's an order of operations in order for it to work properly. You need to aggregate your time first.  It could be as simple as SUM([DATEDIFF,'minute',[1st Time],[2nd Time])  You may have to modify his calc to adjust for minutes instead of seconds.  Pay attention to formatting (have to use a custom number format).

Best, Don

• ###### 10. Re: Convert Minutes field to Hours:Minutes

Try this calc - it should sum for the case you mentioned. It converts the hours to an INT (so loses the ".07") and then pulls in the remainder separately - i.e. the minutes. It is converted to string to give you the appearance you want. No need to format this as HH:MM, that is taken care of in the calculation.

STR(INT(SUM([Mins])/60)) +":"

+

IF SUM([Mins])%60<10 THEN "0" END

+

STR(SUM([Mins])%60)

• ###### 11. Re: Convert Minutes field to Hours:Minutes

Hey Mark i got a solution

In my case i have a value in minutes, if you have in second you need to change the calculated field

This is my tableau output and i got exactly what you wanted

First i created a sum of my minute field

Then i create the hhh:mm calculated field

After that it is just change hhh:mm format

If you are using second value change to minutes or add another line on hhh:mm calculated field like this one