There are different ways of going about this, here's one:
IF [SliceNameField]="Pepperoni" THEN [SliceNameField] ELSE NULL END
Post a packaged workbook and we can get more specific.
While that does work - it's predicated on a specific wedge being a part of all pies.
- We have dynamic dashboards (filterable by the end-user) adn if they want to filter out "pepperoni", the label of the pie disappears despite the presence of other remaining wedges.
- What about a pie that doesn't have a "pepperoni" wedge ? No pepperoni ? No label
I do like the manner in which you are trying to solve this problem, I'm going to see if I can adapt your solution.
Sounds like you may want to look at annotations.
I'm pretty sure that what you're describing is that there are one or more extra dimensions on the Level of Detail that are increasing the number of marks that Tableau draws, though they are all bucketed into the same pie segment. In general, when there's a situation where the view is at one level of detail and we want to aggregate at another, we turn to table calculations. I set up two options in the attached, with Container being the Color, Region the increased level of detail, and Sales being the measure.
In the "change label" worksheet, a table calc is used to return only one label per Container. In the "change measure" worksheet,a table calc sums up the sales so that there's only one non-Null sales measure value per Container, then that is used to build the pie chart. In both cases, copies of the table calcs are used on the Filters Shelf to filter for non-Null values to get rid of extraneous marks.
I generally use the latter solution because it means that the measure value used in making the segments (and the tooltip, and label) is accurate, otherwise you have to use a table calc anyways to get an accurate total per Container. You can see this if you compare the values from the "original" worksheet to the "change label" worksheet, the "change label" worksheet is only showing sales for the particular Container/Region.
pie chart single label.twbx.zip 998.4 KB