8 Replies Latest reply on Dec 4, 2018 5:46 AM by gabriela..zorrilla

# Pie chart: Dump to "Other" category based on % of total.

Hey. I wanna create a pie chart where the categories that represent N% or less (defined by parameter) of the total are assigned to the "Others" slice.

I'm trying to get the SET to work with running totals to no avail.

Any ideas?

Thanks.

• ###### 1. Re: Pie chart: Dump to "Other" category based on % of total.

Hi,

Here is my suggestion

1. create a parameter of type float

2. create a set on your dimension, fill the condition with a formula like this one : calculation < than parameter

3. create a calculation on your set: if "set" then 'other' else your_dimension

4. put the calculation on your pie chart

Cedric

• ###### 2. Re: Pie chart: Dump to "Other" category based on % of total.

Hey Gabriel,

Is this what you're looking for?

These are the key calculations:

Also find the workbook attached.

-Chris Chalmers

• ###### 3. Re: Pie chart: Dump to "Other" category based on % of total.

Hi Chris,

Thanks for the effort!

This is not exactly what I need. With this you calculate the % of the category based on the total and then filter each category if it's under a threshold, but what i need is something like doing a rank based on percent and then a running total and when the running total reaches 0.9 (90%) all the remaining accounts are dump to the OTHERS category.

I can do this in a text table, but not in a pie because the table calculations used.

• ###### 4. Re: Pie chart: Dump to "Other" category based on % of total.

Hey Gabriel,

It might help if you post the table you're describing, I'm not quite understanding. In general the way to do table calcs on hidden series is to put the dimension you want to run along on the Detail shelf, aggregate all marks to a single result using a window aggregation, and then filter to one mark per category using the INDEX() function.

-Chris Chalmers

• ###### 5. Re: Pie chart: Dump to "Other" category based on % of total.

I made a simple DS as a playground, attached. Want the last 2 categories in the "OTHER" but not because they are the last 2 but because the running sum of the percentage is less than 0.9.

• ###### 6. Re: Pie chart: Dump to "Other" category based on % of total.

This is a tricky one. The biggest problem, as I see it, is that you need a running sum in order to make this work. You can do that in table form.

The table calcs have to be set up to compute using Category with a custom sort on SUM(Value) descending.

But all of this hinges on having row level data for each category. When you try to plot this on a pie chart, it falls apart because it must compute using Category, but if you put category on Detail, you'll automatically get a slice for each category.

I don't have a solution for this, unfortunately. Just wanted to add my two cents above. Hopefully someone smarter than I am drops in with a clever solution. I think that I would probably be looking at doing this within a data prep stage. It would still be tricky there as well, but I think it might simplify it a bit. Use of custom SQL to pre-calculate the running sum might also be an option.

• ###### 7. Re: Pie chart: Dump to "Other" category based on % of total.

Definitely tricky. This is as close as I could get:

The colors are based on the truncated category, but there is still one mark per original category.

-Chris Chalmers

• ###### 8. Re: Pie chart: Dump to "Other" category based on % of total.

Yeah, I arrived to the same thing in one of my iterations. Looks like it's not possible to do it in Tableau.