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 Average.
  1. Create a visualization with Sales in Columns, Sub-Category in Rows, and Sales Highlight in Color.
  1. You can change the color of the three values to make it easier to see the difference between great and bad values. Here's the final result:

Keep this example, as we'll see how to make it better in the following section.

As you can see, simple calculations can already be useful. In the next section, we'll see how to use two sorts of advanced functions: Table Calculation and Level of Detail. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.20.87