2 Replies Latest reply on Apr 2, 2013 6:51 AM by Aaron Parry

    change minutes to mm:ss

    Aaron Parry

      I'm looking for a calculation that will allow me to change minutes with a float, that I have set to a decimal right now (7.75) into mm:ss (7:45)

       

      Thanks!

        • 1. Re: change minutes to mm:ss
          Dan Huff

          Aaron--

           

          Here is a calculation that may do the trick for you:

           

          str(int([Time])) + ":" + str(([Time]%1)*60)

           

          This basically uses the original field you have in floating format and turns it into the desired string mm:ss format using some algebra. In case you are unaware of its presence, the % sign in this case is Tableau's mod function.

           

          Hope this helps,

           

          Dan

          1 of 1 people found this helpful
          • 2. Re: change minutes to mm:ss
            Aaron Parry

            Dan,

             

            Thanks for the response! I was able to use this calculation to obtain my desired result:

             

            STR(INT(SUM([SecondsToTime])/3600))


            + ":" +


            IF INT(SUM([SecondsToTime])%3600/60)

            < 10 THEN "0" ELSE "" END + STR(INT(SUM([SecondsToTime])%3600/60))


            + ":" +


            IF INT(SUM([SecondsToTime]) %3600 %60)

            < 10 THEN "0" ELSE "" END + STR(INT(SUM([SecondsToTime]) %3600 %60))