8 Replies Latest reply on Dec 3, 2013 8:46 AM by Matt Lutton

    Formatting Percent and Numbers in the same sheet / Calculated field destroys formatting

    Stacey Rothchild

      I posted a question on the other "Calculated Fields Destroy my Number Formatting" thread  (http://community.tableau.com/thread/118621) but I'm still having issues. I have both numbers and percentages in the same worksheet. I also have a field called "calculation type" where it holds 1 for a number and 2 for a percent. I am trying to get the percents to have the symbol at the end and leave numbers plain. I have tried some code to do this and get the error where it now carries out the decimal to 17 places (known bug I guess with the str(Round(something)) function).

       

      I tried adding a decimal to eliminate it but no luck.

       

      IIF ([CalculationType]=2,

      (str(ROUND(IF ([Rate] > 0) THEN ([Rate] +0.000001) ELSE ([Rate]-0.000001) END,2))+"%"),

      str(ROUND(IF ([Rate] > 0) THEN ([Rate] +0.000001) ELSE ([Rate]-0.000001) END,2)) )

       

      I'm wondering if anyone has figured out a work around for this? I am still a new Tableau user (less than a month) so any help would be great. My dataset has "Metric Name" and "Metric Date" and "UnitName" with each unit having many metrics and many dates in the original Access query (datasource).