2 Replies Latest reply on Jul 14, 2016 10:17 AM by Nathan Schwinnen

Subtotals for calculated fields

I have a table where one of the columns is a calculated field.  The calculated field is a percentage of two of the other columns.  I want my subtotal to add up the total percentage, but instead it just performs the percentage calculation again.  So for instance,

I get..

Quantity          Needed Quantity          %

Red              5                    10                         50%

Blue             8                    10                         80%

Green          7                    10                         70%

Total          20                    30                         67% (Tableau calculates 20/30=.66667)

I want to get..

Quantity          Needed Quantity          %

Red              5                    10                         50%

Blue             8                    10                         80%

Green          7                    10                         70%

Total          20                    30                        200% (I want Tableau to add this column)

My table is not quite this simple, but this should give you an idea of the problem.

Anyone know how to get that last column to add my percentages instead of calculating a percentage of the totals?

• 1. Re: Subtotals for calculated fields

Nathan,

When I try to recreate this I get your desired results and can't recreate the problem. A couple of ideas:

- Go to the Analysis Menu>Totals>Total all using>SUM.

- You mentioned your view isn't quite this simple, perhaps some other things about your view are causing the issue. If you can provide some additional details or a sample workbook that shows the problem we can take a look.

Ken

• 2. Re: Subtotals for calculated fields

Not sure I can post the workbook, but here is a screenshot:

Weekly quantity is a formula: Quantity Delivered Last 30 Days/30*7

Weekly Cube takes the weekly quantity and divides it by (MAX) Racks per Truck.  (MAX)

Tableau is using the formulas in the subtotal, not just adding up the columns.  The Weekly Quantity is 405 because Tableau took 1737/30*7, not because Tableau added 39+88+186+9+83.

Weekly cube is 132.0% (405/307) and I need it to be 827.7% (54.1+220.5+159.1+15.4+378.6)

I don't think there is anything illogical about the way Tableau is calculating subtotals, but I am hoping there is a way to customize it to fit my needs.

Also, I tried Analysis Menu>Totals>Total all using>SUM.  This changed nothing.