KNOWLEDGE BASE

## How to color the areas on the pie chart that are over 100% or less than 100% of the target

Published: 15 Mar 2023

### Question

How to color the areas on the pie chart that are less than 100% or more than 100% of the achievement

<Example 1>
Achievement is 120%

<Example 2>
Achievement is 80%

### Environment

• Tableau Desktop

1. Connect to attached data source 'test.xlsx' from Tableau Desktop.
2. Create a new calculated field as following.
Name : Over Achievement Area
Calculation : IF sum([Sales])/sum([Target]) > 1
THEN sum([Sales])/sum([Target]) - 1
END
3. Create a new calculated field as following.
Name : Less Achievement Area
Calculation : IF sum([Sales])/sum([Target]) <= 1
THEN 1 - sum([Sales])/sum([Target])
END
4. Create a new calculated field as following.
Name : Achievement Rate
Calculation : sum([Sales])/sum([Target])
5. Create a new calculated field as following.
Name : Achievement Area
Calculation : IF [Achievement Rate] > 1
THEN 1-[Over Achievement Area]
ELSEIF [Achievement Rate] <= 1
THEN 1-[Less Achievement Area]
END
6. Create a new parameter as following.

7. Create a new calculated field as following.
Name : Year Filter
Calculation : [Year]=[Select Year]
8. Change the mark type to Pie.

9. Drag [Achievement Area] , [Less Achievement Area] and [Over Achievement Area] to the view.

10. Drag [Measure Name] on Rows to Color on Marks.

11. Click on Size on Marks -> Adjust size with slider

12. Drag [Year Filter] to Filter pane -> Check in 'True'.

13. Right click on [Measure Name] on Color -> Sort -> Set as following.

14, Right click on [Select Year] -> Show parameter