KNOWLEDGE BASE

Showing Color Legends for Categories with No Data


Published: 14 Jun 2014
Last Modified Date: 23 May 2016

Question

How to show all categories in color legends, especially those with no corresponding values in the view.

Environment

Tableau Desktop

Answer

Step 1: Create Data

  1. Open a new worksheet in Microsoft Excel.
  2. In the top-left cell, type in Region. This is your column heading.
  3. In the Region column, type East, West, Central, South, North each on its own row.
  4. Save the spreadsheet as Legend.xlsx.

Step 2: Connect to Data

  1. In Tableau Desktop, select Data > Connect to Data.
  2. Select Microsoft Excel, and then open Legend.xlsx.
  3. In the Excel Workbook Connection dialog box, select Sheet1, and then click OK.
  4. Select Connect Live.
  5. Navigate to Data > Connect to Data, and connect to Superstore sample data.

Step 3: Create Views

  1. From the Superstore sample data, double-click Region and Sales.
  2. Drag Region to Color.
  3. Select Worksheet > New Worksheet.
  4. Under Data, select Sheet1 (Legend.xlsx).
  5. Right-click Region, and then select Default Properties > Color.
  6. Edit color to match the color legend in the main data source, and then click OK.
  7. From Sheet1 (Legend.xlsx), drag Region to Rows and to Color.
  8. Under Data, select the Superstore sample data, and then drag Region to Rows.
  9. Right-click this Region field on Rows, and then clear Show Header.

​Step 4: Create Dashboard

  1. Select Dashboard > New Dashboard.
  2. Drag Sheet 1 and Sheet 2 onto the view.
  3. Remove the layout container that includes the legends. For more information, see Layout Containers in Tableau Help.
  4. Select Dashboard > Actions.
  5. In the Actions dialog box, select Add Action > Filter, click Select, and then click OK twice.
Did this article resolve the issue?