KNOWLEDGE BASE

Showing Intermediate Values on a Stepped Color Legend


Published: 09 Feb 2018
Last Modified Date: 09 Feb 2018

Question

How to show every step of a color legend on the legend, rather than just the min and max values.



 

Environment

Tableau Desktop

Answer

In this example, we will create a 4 steps color legend, associated to a map of Sales by State using the Superstore data source.

Build the view:
  1. Connect to Superstore
  2. Drag State to details and Sales on colors
  3. Edit the color legend to choose 4 steps


Build the legend:

Create the following calculated fields:
  • Tick 0 : MIN({INCLUDE [State]: SUM([Sales])})
  • Tick 1 : MAX({INCLUDE [State]: SUM([Sales])})*0.25
  • Tick 2 : MAX({INCLUDE [State]: SUM([Sales])})*0.5
  • Tick 3 : MAX({INCLUDE [State]: SUM([Sales])})*0.75
  • Tick 4 : MAX({INCLUDE [State]: SUM([Sales])})
  1. Drag 4 copies of MIN([Number of Records]) to Columns (one for each step)
  2. Select Bar chart as chart type and increase the size to the maximum
  3. Edit each axis to a fixed range from 0 to 1
  4. On the first copy of MIN([Number of Records]), drag Tick 1 to Text. Repeat to have one tick per mark.
  5. Create a field MIN(0) on columns, just after MIN([Number of Records]) and select Dual Axis and Synchronize Axis
  6. On the MIN(0) mark, drag Tick 0 to Text
  7. Right click on the first copy of MIN([Number of Records]) and uncheck 'Show Header'
Did this article resolve the issue?