I have a dashboard where I want a set of measures to be displayed in a very specific way and because I don't like how it looks as a Tableau table I tried to concatenate it together as a string field. However when I convert my values to strings the number formatting isn't preserved and I end up with scientific notation and long strings of decimals. Is there a way within my formula to preserve the number formatting I have the field set to?
This is the string I want:
Here is the formula:
STR(SUM([Sales]))+" "+STR(([% of Forecast]))
And what Tableau returns:
[Sales] is set to 0.0M and [% of Forecast] is a custom percentage, 0 decimal with the ()'s - (0%)
You will have to do the formatting manually before turning it into a string...
Try this formula:
"$" + STR(ROUND(SUM([Sales])/1000000,1)) + "M (" + STR(ROUND([% of Forecast])*100,0) + "%)"