mkingsbu
mkingsbu

Reputation: 354

Tableau creating a calculated percentage (non-aggregate) based on an aggregated total

Either I am the first person to ever need to display percentages in Tableau or I do not know what to search for! I highly suspect it is the latter...

I believe what I am attempting to ask is how to make a calculated non-aggregated field by dividing by an aggregated number. Although I would prefer just to be able to display the percentages instead of a whole number.

This is how I would do it in Excel:

enter image description here

The data that already exists is Column A and B. In Tableau these would be non-aggregated. What I need to do in Tableau is to generate what is column C (also non-aggregated) because it does not exist in my data. In excel, all I did to get the aggregate number (total) of column B was:

sum(B1:B4)

And for the column C:

=B1/$B$5

But I can't seem to do this at all in Tableau. When I try to use the same syntax, I get an error message: "Cannot mix aggregate and non-aggregate arguments with this function."

Upvotes: 1

Views: 1437

Answers (1)

merlot
merlot

Reputation: 620

Instead of having a calculated field, you can use a Quick Table Calculation on the column.

Right-click the pill of your data > Quick Table Calculation > Percent of Total. This will show the percentages instead. If you want to keep both, just duplicate column b first and then add the table calculation to the new column.

Upvotes: 7

Related Questions