KNOWLEDGE BASE

Conditionally Format the Color of Individual Columns in a Crosstab View


Published: 23 Apr 2013
Last Modified Date: 21 Nov 2016

Question

How to conditionally format the color of each measure in a crosstab view.

Environment

Tableau Desktop

Answer

Step 1: Create calculated fields for each measure used

  1. For every measure that you want to include in the view, select Analysis > Create Calculated Field.
  2. Name the field. Consider including the name of the measure in it. For example, Sales Col.
  3. In the Formula field, type 0, and then click OK.

Step 2: Build the view

  1. Drag Region to Rows.
  2. Drag each calculated field that you have created to Columns
  3. In the ALL Mark cards, ensure the Text is selected as a Mark Type.
  4. In each mark card, drag the associated measure to Details and to Color. For example, drag Sales to Details in the SUM(Sales Col) mark card. 
  5. Modify the color of each measure as desired.
  6. Right-click each measure on the axis and select Edit Axis
  7. Navigate to the Tick Marks tab > select None for Major tick marks and Minor tick marks, and then click OK.
  8. In the Rows, right-click any of the calculated field and select Format
  9. Click the Lines icon and navigate to the Columns tab. 
  10. In the Zero Lines drop-down menu, select None.

Step 3: (Optional): move titles to the top

  1. For each desired column in the finished crosstab, drag two copies of the calculated fields created in the directions above to the Columns shelf
  2. Drag the desired measure to Text in both copies of the calculated field
  3. Right-click on the second copy of the calculated field on the Columns shelf and select Dual Axis
  4. Edit both the top and bottom axes as desired

Additional Information

To view these steps in actions, see the video below: 


Note: It will not be possible to sort the measures by clicking on the axis after using this solution, but it will still be possible to sort by right-clicking Region and sorting by a specific measure. See How to Sort Data (Computed Sorts) for more information.
Did this article resolve the issue?