Commas in String numbers in Tableau

Viewed 4774

I am using a number inside a calculation and have to turn it into a string. When I do this, I lose the comma formatting. Using another post:

Changing Number Format in a String

However the formula, I am using:

STR(ROUND(LOOKUP(sum([Actual]),0),0))

Does not seem to be working. The full calculation is here:

If attr([Kpi Nm]) = "Policy Retention Better-than-State Average"
    Then str(round(sum([Actual]) * 100, 2)) + "%"
ElseIf attr([Kpi Nm]) = "Policy Retention Improvement (or > 90%)**"
    Then str(round(sum([Actual]) * 100, 2)) + "%"
Elseif attr([Kpi Nm]) = "Premium Growth"
    Then str(round(sum([Actual]) *100, 2)) + "%"
Elseif attr([Kpi Nm]) = "PIF Growth"
    Then str(round(sum([Actual]), 2))
Elseif attr([Kpi Nm]) = "Product Density"
    Then "NA"
else
   STR(ROUND(LOOKUP(sum([Actual]),0),0))
End

I need to keep the commas on the Actual for the else statement. Any help provided would be much appreciated. The Lookup is supposedly a trick to make it work but does not work in my case.

Thanks,

2 Answers
Related