13 Replies Latest reply on Nov 17, 2016 7:44 AM by marek.lukaszuk.0

# Running percent of total within stacked bars chart

Hi everyone,

I have a stacked bars chart and I want to know how to get a running percent of total on it, so I can hide the bars making say more than 80% of total value across all bars.
How can I create a calculation field that will give me a running percent each bar make, not its parts. So, having 9 bars, I should reach 100% with the last bar.

Thanks a lot!

Marek

• ###### 1. Re: Running percent of total within stacked bars chart

Hi Marek,

This is simply done using nested Table Calculations.

Please find the workbook attachment.(Sample super store) for reference.

Please let me know if it helps.

Regards,
Kajal

3 of 3 people found this helpful
• ###### 2. Re: Running percent of total within stacked bars chart

Hi Marek,

As you can see in the pic what it is showing like percent of total for running total across the different Sub-Category so the last Sub-category will show the 100%.

For this you should create two table calculation.

1 of 1 people found this helpful
• ###### 3. Re: Running percent of total within stacked bars chart

Hi Kajal,

It's not exactly what I need. I recreated your steps and what I got is a running cumulative % per sub-category and what I need is a value of Percent from total for each category. I need a field I can use later as a filter to filter out those bars that make more than 80%.

Calculation should sum values of all sub-categories per category and tell me what it makes in terms of % of total (all values on the chart). Knowing that value for each bar, I can hide those that have value > 80%

Thanks,

Marek

• ###### 4. Re: Running percent of total within stacked bars chart

Hi marek,

I am not able to understand  the requirement. Please throw some more light on the scenario you are talking about,.

Thanks,
Kajal

• ###### 5. Re: Running percent of total within stacked bars chart

i think this is what you are looking for. in this case i filtered out the bars that were greater than 71%.

to accomplish this, I set sum(sales) as a percent of total, then computed the table calculation to occur using pane down or region in this example.

• ###### 6. Re: Running percent of total within stacked bars chart

additionally, if i wanted to filter out the individual bar then i could get the value excluding the region detail.

• ###### 7. Re: Running percent of total within stacked bars chart

Hi Kajal,

I want to calculate a sum of values of all sub-categories making each bar to know what % of total (here 200) it makes.

So for the first bar the calculation should give me 40 or 20% of the total. And so on for each column with small difference that the % for the second bar would be a % the first two make of total, and so until we get 100% for the last bar.

Knowing that say third bar make 80% of total I can create Boolean calculation field that checks if this value is greater than 80%, put it on filter shelf to filter out those making more than 80% of the total value. So eventually I would see only first three bars but all broken down into sub-categories.

1 of 1 people found this helpful
• ###### 8. Re: Running percent of total within stacked bars chart

Hi Marek,

This is what you're after, I guess;

That is nested table calculations:

computed along your bar components - segment in my wb and [Kat. zagr..] in your case

this outer calc is computed across (or sub-category) - your [Gr. zagr.]

As you can see you may use the outer calc as a filter.

Łukasz

2 of 2 people found this helpful
• ###### 9. Re: Running percent of total within stacked bars chart

Thanks Łukasz,

I can see it is exactly what I wanted. First part with Bar total is working but with the second one, Bar running % I am missing something that is maybe not on your print screens. (I cannot access your file in Tableau public). I have recreated steps for it as on your pics but I get 100% on all bars instead of running %. Seemingly denominator gives the same value as numerator.

Marek

• ###### 10. Re: Running percent of total within stacked bars chart

The attached wb is built in tableau 10.0

Anyways when you drop the second (outer) calc onto details shelf you have to address both nested and outer fields appropriately:

Does that help?

• ###### 11. Re: Running percent of total within stacked bars chart

Not yet, but we're so so close. I figured out it is now the matter of addressing both fields correctly but something is mixed up in your pictures. All showing Table calculation for the same field but with different settings.

I have version 10.0 of Tableau but with Tableau Public you can only open files stored to Tableau public

• ###### 12. Re: Running percent of total within stacked bars chart

OK, published to public: Tableau Public

Please note you have to address 2 calculations - one is nested and referenced in the outer one. In the first pic I am showing how to select the calculation for addressing and the other 2 show them as addressed differently:

• ###### 13. Re: Running percent of total within stacked bars chart

Łukasz, it worked! Thanks a lot!

1. First formula was:

1.1 Its Table Calc on Details shelf was:

2. Second formula was:

2.1 Its Table Calc on Details shelf was:

For general use: 'Gr. zagr.' is a 'Sub-Category' in solution provided by Łukasz whereas 'Kat. zagr.' is his 'Segment'

1 of 1 people found this helpful