Example – highlight values

Probably the most common use of calculation is to highlight values. Let's create a calculation that returns different text values depending on sales:

  1. Open Tableau Desktop and click on the Sample - Superstore saved Data Source.
  2. Create a new Calculated Field and name it Sales Highlight.
  3. Write the following formula and check that the calculation is valid: if SUM([Sales]) > 300000 then "Great" ELSEIF SUM([Sales]) < 50000 then "Bad" else "Average" END.
This formula is a conditional test. If the sum of sales is higher than 300 000, the formula returns the text Great, if the sum of sales is lower than 50 000, the formula returns Bad, and in the other cases (when the sales are between 50 000 and 300 000, the formula returns  ...

Get Getting Started with Tableau 2018.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.