How To Change Shape In Color Legend When Selecting Mark In Color Legend

Published: 25 Aug 2021
Last Modified Date: 30 Aug 2021


How to change the marks in the color legend from ■ to □ and remove the selected line from a line chart when clicking a mark in the color legend?
User-added image


  • Tableau Desktop


The following steps are demonstrated in the attached workbook using Sample - Superstore.
  1. Open a new sheet named Line chart and place fields as below.
  • Columns: Month of Order Date
  • Rows: Sales
  • Colors: Region
  • Filters Year of Order Date
  1. Right-click Region > Create > Set.
  2. Select all regions and click OK.
  3. Click Analysis > Create Calculated Field and name Region Set or Blank with the following formula.
    	IF [Region Set] THEN [Region] ELSE "Blank" END
  4. Place Region Set to filters.
  5. Open a new sheet named Color legend and change the mark type to Shape.
  6. Place fields as below.
  • Rows: Region
  • Colors Region
  • Shape: Region Set or Blank
  • Filters: Year of Order Date
  1. Right-click YEAR(Order Date) in the filters pane > Apply to Worksheets > All Using This Data Source.
  2. Click Shape and select filled square marks for all religions.
  3. Right-click Region Set > Edit
  4. De-select all regions and click OK.
  5. Click Shape and select white square marks for all regions.
  6. Open a new dashboard and place the Line chart sheet and the Color legend sheet.
  7. Click Dashoard > Actions, then click Add Action > Change Set Values.
  8. Set the set action as below, then click OK.
  • Source Sheets: Color legend
  • Run action on: Select
  • Set: Region Set
  • Running the action will: Remove values from set
  • Clearing the selection will: Add all values to set.
Did this article resolve the issue?