2 Replies Latest reply on Sep 6, 2018 1:20 PM by Aaron Dobbins

    Format number/date in tool tip into hour/minute format

    Michael McNenny

      Is there a way to format a number/date in the tool tip?  I have a field in my data sheet named 'Driving Duration'.  Branch 1, as an example, has a driving duration of '1 h 47 min'.  The value display correctly in Excel as such even though the real number is 1:47:00 AM.  The tool tip displays this value as "12/30/1899 1:47:00 AM".  Is there a way to format this as '1 h 47 min' in the tool tip?  In Excel, the custom formatting used is [>0.0416550925925926][h]" h "mm" min";[m]" min" (I have also attached the Excel document if needed).  Any comments appreciated.  Thanks

        • 1. Re: Format number/date in tool tip into hour/minute format
          Naveen B

          Hi Michael,

           

          Follow the below steps

           

          1)

           

          2) Change your custom format like below

           

          Format : hh "hour" nn"Min"

           

          3) Your tool tip like below

           

          Hope this helps

           

          Plz mark this answer as correct or helpful to close the thread

           

          BR,

          NB

          2 of 2 people found this helpful
          • 2. Re: Format number/date in tool tip into hour/minute format
            Aaron Dobbins

            Hi Michael,

             

            Not sure Tableau's custom formatting can handle that level of customization, but you could create a calculated field to get what you need.  Drop the pill into the tooltip area and put it where you want!

             

            Drive Time Tooltip

            STR(DATEPART('hour',[Driving Duration])) + " h " + STR(DATEPART('minute',[Driving Duration]) + " min"

             

            Or if you wanted to not display hours if drive time < 1 hr, or not display minutes if it was a whole number hour, you can do some logic checking:

             

            IF    DATEPART('hour',[Driving Duration]) > 0

              AND DATEPART('minute',[Driving Duration]) > 0 THEN

                    STR(DATEPART('hour',[Driving Duration])) + " h " + STR(DATEPART('minute',[Driving Duration])) + " min"

            ELSEIF DATEPART('hour',[Driving Duration]) > 0

              AND DATEPART('minute',[Driving Duration]) = 0 THEN

                    STR(DATEPART('hour',[Driving Duration])) + " h "

            ELSEIF DATEPART('hour',[Driving Duration]) = 0

              AND DATEPART('minute',[Driving Duration]) > 0 THEN

                    STR(DATEPART('minute',[Driving Duration])) + " min "

            END

             

             

             

            1 of 1 people found this helpful