The only caveat with this trick is that you can’t have negative values or zeros because those actual negatives and zeros would get this new custom format applied to them.įor more ideas on using shapes such as stars in your data visualization, see 3 Ways to Use Alt Code Characters to Enhance Your Tableau Dashboards.When rounding using decimal places (dp), the degree of accuracy that is required is usually given. In other words, you can display a star to let the end user know they don’t need to worry about that item, but if they want to be reminded of the actual performance, they’ll see it when they hover over the marks.
If you would still like to display the actual value for any of these dimension members on the table, you can simply add the original measure to the Tooltip Marks Card. Here’s how the view looks when typing a star alt-code character as the third number formatting. Now if I go type a second semicolon into the custom formatting for our calculated measure, whatever number format I type next will be applied to the values that are above goal. In addition to displaying four decimal places for values less than one and two decimal places for values greater than one, this formula will now convert the values that are past our goal of 50 to zeros. If we are trying to display four decimal places for values that are less than one and two decimal places for numbers that are greater than one, we can use the following calculated field: I could either change the default formatting of the measure or change the format of the measure for this specific view to change the number of decimal places, but in both cases, all the numbers would share the same number of decimal places. If I were to make a table with these numbers in Tableau, the measure values would have “Automatic” formatting applied and every number would display one decimal place. Note the measure values include varying levels of decimal places. To illustrate the dynamic formatting, I’ve put together this dummy dataset with ‘ten things’. If your only objective is to round decimal places based on a measure’s value, you can use Tableau’s ROUND and IIF functions in a calculated field. This first approach was a tip I received from a friendly email subscriber.
View / Interact / Download › Using Tableau’s ROUND and IIF functions to display varying decimal places
Premier Tableau eLearning from Playfair Data TV Instead, this post will show you two alternative approaches that allow you to control the prefix, suffix, and/or the number of decimal places when you are trying to display two (or even three!) number formats for the same measure in Tableau. My first instinct was to dynamically format the numbers with parameters, but this technique only works for controlling the prefix and suffix of each different number type. I loved the concept though because I’m a big believer in maximizing the data-ink ratio and the extra decimal places could be considered redundant data ink.
This was a brainteaser because, by default, Tableau limits you to one number format per measure. They were trying to display four decimal places when the measure value on the view was less than one, but only two decimal places when the measure value was greater than one. I recently received a great question from a Twitter connection, and I figured I would share the solution here in case it helps anybody else. This content is excerpted from my book, Innovative Tableau: 100 More Tips, Tutorials, and Strategies, published by O’Reilly Media Inc., 2020, ISBN: 978-1492075653.