ChrisG
ChrisG

Reputation: 1251

Tableau: How do I calculate the proportion of one value as a percentage of another value, when the dimensions are in the rows

I'll lead by saying that I'm fairly new to Tableau and that I'm currently on version 9.1.

Here's the format of my data:

Date        Color   Fruit   Value
1/1/2016    Red     Apple   1
1/1/2016    Red     Apple   2
1/1/2016    Red     Pear    2
1/1/2016    Red     Pear    3
1/2/2016    Green   Apple   4
1/2/2016    Green   Apple   2
1/2/2016    Green   Pear    1
1/2/2016    Green   Pear    2

How would I calculate the sum of Apples as a percentage of all Fruit? What about Red Apples as a Percentage of All Apples?

Please feel free to comment on how I can clean up this question, I know it's in bad shape. Thanks.

Upvotes: 0

Views: 4553

Answers (1)

Fabio Fantoni
Fabio Fantoni

Reputation: 3167

In order to show the % of a Total you should Right-click your measure and select Quick Table Calculation --> Percent of Total.

enter image description here

Example Drag Furit on Rows and then Value on the Pane. You should get:

Apple 9
Pear 8

Now you can add your quick table calculation and you'll get:

Apple 52,941%
Pear 47,059%

EDIT for Second Question

Dragging color in the rows shelf will update alle the %'s (of total). If you want to see %'s by fruit, you just need to adjust the Computing type of your table calculation. In order to do that, yo have to right click your measure and then click on "Compute Using" and then select Fruit.

enter image description here

Upvotes: 3

Related Questions