KNOWLEDGE BASE

How to set the color by selected data and the other data in a Pie Chart


Published: 21 Jun 2023
Last Modified Date: 26 Jun 2023

Question

How to set the color by selected data and the other data in a Pie Chart

<IMAGE>
In this case, displaying Sales by Category.
If you select 'Furniture' in parameter, divide color of Pie Chart by 'Furniture' and the other data.
User-added image

Environment

  • Tableau Desktop

Answer

Please follow along with the attached sample workbook to the right of this text in the Attachments section.

<STEP 1>
-Create calculated fields and parameter-
1. Connect to Sample Superstore from Tableau Desktop.
2. Right click on  [Category] -> Create -> Parameter -> OK
User-added image
3. Right click on Parameter [Category Parameter] -> Show Parameter
4. Create a new calculated field as following.
     Name :Selected Category or The Others
     Calculation : IF [Category]=[Category Parameter]
                          THEN [Category]
                          ELSE 'The Others'
                          END

<STEP 2>
-Create a Pie chart-
5. Change the chart type to Pie.
User-added image
6. Drag [Sales] to Label and Angle.
User-added image
7. Drag [Selected Category or The Others] to Color and Label
User-added image
Did this article resolve the issue?