I don't think that formatting can be applied in the sense of using the format menu and such, but...
If the numerical formatting is all you need, try something like this:
LEFT( STR([PercentOfTotal]*100), 7) + "%"
That assumes your percentages won't go over 1,000 and thus that you won't need the comma separators. Those you can do in a similar way, although depending on the range of possible values in your data, you might need more code (for example, "if it's a 7 digit number, then put in 2 commas, if it's 6 or less but more than 3, put in one, otherwise don't put in any").
If you find a better way, let us know.
If you create calculated fields for each of the sub-calculations, you can set the appropriate format for each calculated field and then use those fields in the final calculated field. However, lots of calculated fields can impact the performance of Tableau on large data sets.
That sounds much better (except, as you noted, for large datasets). Thanks!
So, I have a slightly different question. Can we do some magic in calculated fields such that you get this result:
this dish has 236 calories per serving.
In other words, can we embed escape codes inside a calculated field, similar to using CHAR(), to get text effects like this. So, something like RTF formatting in a tool tip, but in a calculated field.
Any help is appreciated.
Michael W Cristiani