KNOWLEDGE BASE

Coloring Only One Measure in View


Published: 01 Aug 2013
Last Modified Date: 25 Apr 2016

Question

How to dynamically color one measure in a view, using a calculated field.

Environment

Tableau Desktop

Answer

Option 1: Create a worksheet for each measure

  1. Create the view with only the desired measure.
  2. Create a calculated field to dynamically color only that measure, similar to the following: 
    IF AVG( [Measure1] ) < 0 THEN 'Below Zero'
    ELSEIF AVG( [Measure1] ) = 0 THEN 'Zero'
    ELSE 'Above Zero'
    END
  3. Place this calculation on Color on the marks card.
  4. Repeat steps 1-3 for all additional measures.
  5. Place all worksheets on a dashboard together, and format as desired (i.e. remove the title, etc.).
 

Option 2: Place dimensions in container calculated fields (Crosstab only)

Create a container calculated field:
  1. Select Analysis > Create Calculated Field.
  2. In the Calculated Field dialog box:
    1. Name the calculated field. In this example, the calculated field is named "Container".
    2. In the Formula field, enter 0.
    3. Click OK.
Create the view:
  1. Drag two copies of [Container] onto the Columns shelf. Note, Tableau Desktop will show one marks card for each copy of container called: Sum(Container) and Sum(Container) (2).
  2. For each of the two marks card tabs for the two copies of [Container]:
    1. Choose Text in the drop-down menu.
    2. Drag the first measure onto Text.
    3. Drag the desired calculated field onto Color.
  3. Right-click on the second copy of [Container] on the Columns shelf and select Dual Axis.
  4. Repeat steps 1-3 for each measure in the crosstab.
Clean up the view:
  1. Right-click the first field on the Columns shelf and then select Format.
  2. In the Format pane, click the paintbrush icon.
  3. From the Zero Lines drop-down menu, select None.
  4. Close the Format Lines plane.
  5. For each bottom axis, right-click the axis and then select Edit Axis.
  6. In the Edit Axis dialog for the bottom axis:
    1. On the General tab, change make the title blank.
    2. On the Tick Marks tab, select None for Major tick marks and Minor tick marks.
    3. Click OK.
  7. For each top axis, right-click the axis and then select Edit Axis.
  8. In the Edit Axis dialog for the top axis:
    1. On the General tab, change the title as desired.
    2. On the Tick Marks tab, select None for Major tick marks and Minor tick marks.
    3. Click OK.

Option 3: Add multiple fields to Color

  1. Create the desired view.
  2. Drag [Measure Names] to Color on the marks card.
  3. Shift+Drag the calculated field onto the marks card.
  4. Click Color and select Edit Color....
  5. In the Edit Color dialog edit colors as desired.
Did this article resolve the issue?