Custom Number Formatting in Tableau

Any number in your Tableau dashboard can and most likely should be formatted. Just browsing around Tableau Public at the time of writing this blog, I stumbled across this dashboard, that has been trending right now:

The red circles show examples of numbers that have been formatted to exactly how the creator of the dashboard has decided to display them, irrespective of what they might look like in the dataset. As you can see, this holds true for both numerical data and date-related information. In general, there are multiple ways to format numbers in Tableau, as described here for example. The typical text box you see when formatting numbers in Tableau looks like this though:

A handy way to make use of this function is to hit any other field than "Custom" first, e.g. "Number (Custom)", then switch over to "Custom". This way, it will be pre-filled with the current format as defined in the field you selected prior to that, in this case "Number (Custom)". Here you can now fully customize three parts of numbers separately, divided by ";", which comes down to this syntax:

positive_number;negative_number;zeros

You don't have to specify values for each part though. Leaving out number parts is interpreted by Tableau like this:

1 part specified only  ->  this format is used for all numbers
2 parts specified   ->    1st part specifies positive numbers & zeros
               2nd part specifies negative numbers

You do have to include semicolons if you skipped a number part though. For example, you can hide any zeros by entering "#,###;-#,###;;". This works because you specified how to display positive numbers (part 1), negative numbers (part 2), but there is no character in the third part of the syntax, not even a blank, and this is the part that corrensponds to zeros. So this formatting syntax is as compact as it is powerful. You could also prefix or suffix values, or change the from positive to negative if you ever need to. Use this table taken from the Tableau docs to piece together a way to specify whichever format you desire:

Alternatively head over to this blog post to figure out how to that:

Author:
Matthias Albert
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab