Skip navigation

Apply number formatting inside a calculated field

score 889
You have not voted. Active

I need to be able to take numbers and apply number formatting to them based on the logic of my calculation.  The number formatting should be exactly the same as the "Custom" formatting that tableau does now.  So, if I have a calculated parameter that should be a percentage sometimes and an integer other times, I could say

 

if <condition> then Format([percentage], "#.00%") else Format([integer],"#,##0.0") end

 

Key Benefits:

1) Allows you to format measures depending on the parameter. 

Example: You want to allow the user to select whether to display a measure in thousands, millions, or units. 

 

Case [Size Parameter] when "Thousands" then Format([number],"#,.0") when "Millions" then Format([number],"#,,.0") else format([number],"#,###.0" end

 

2) Gives you more granular control over how to format numbers

3) Allows logic to apply to formatting

 

--> Community Manager update Oct 2nd 2019  [Ciara Brennan]

As per note below by Thomas Nhan in our Dev team, we are investigating this feature request and if you have use cases that can't be solved with calcs, please reach out with your feedback to Thomas at tnhan@tableau.com

 

 

Comments

Vote history