5 Replies Latest reply on Feb 18, 2016 5:34 AM by pooja.gandhi

    Aligning Numbers by Decimal Point

    Erika Baldwin

      I'd like to align numbers in a column by decimal point in a text table, in accordance with APA format. How do I do this?

        • 1. Re: Aligning Numbers by Decimal Point
          Simon Runc

          hi Erika,

           

          Not totally familiar with the APA format (...well at all, but a quick Google search!!), but I think you can use the 'custom formatting' to do this

           

          Let me know if this works for you. If not let me know where it fails and I'm happy to take another look

          • 2. Re: Aligning Numbers by Decimal Point
            Erika Baldwin

            Hi Simon,

             

            That worked! However, they only aligned when I used the custom format 00.0%, which adds a leading 0 to numbers less than 10% (e.g., 05.4%).

            Capture.PNG

             

            I also tried #0.0% (and combinations thereof), but that did not work.

             

            Capture2.PNG

             

            I'd like them to align according to the first photo, just without the leading zeroes.

            • 3. Re: Aligning Numbers by Decimal Point
              Simon Runc

              hi Erika,

               

              So one way to do this is to create 2 calculated fields, one for when the value is <10% and one where it is >=10%. The formulas are;

               

              Notice how the ELSE condition is NULL. As Tableau doesn't plot NULLs (well it can't!), we can then place these 2 fields side by side in the text box

               

              This then gives us independent formatting control over each field. We set up the >=10% as normal

               

              and add in an extra 'Space' for the <10% one (well actually I added 2, as this seemed to line up better)

               

               

              ...as a very simple alternative, as the right part (decimal places and %) are the same for every value, Right Aligning the text would also line up the decimal points, without the need for the above method.

               

              Hope this does the trick, and makes sense.

              • 4. Re: Aligning Numbers by Decimal Point
                Shawn Wallwork

                Erika, I'm not familiar with APA style either. But it sounds like all you need to do to get all the decimals to line up is use a monospace font.

                 

                 

                 

                Courier New & Consolas are the most ubiquitous of the mono space fonts.

                 

                --Shawn

                2 of 2 people found this helpful
                • 5. Re: Aligning Numbers by Decimal Point
                  pooja.gandhi

                  That was a nice little trick there, Shawn!

                  1 of 1 people found this helpful