KNOWLEDGE BASE

Aggregating a Percentage Across a Category


Published: 18 Oct 2016
Last Modified Date: 18 Oct 2016

Question

How to aggregate a percent of total.

Environment

  • Tableau Desktop 10.0.0
  • Windows 7

Answer

A percentage across a category often takes the form of a table calculation with aggregation:
SUM([measure]) / TOTAL(SUM([measure]))


Consequently, it is not possible to aggregate further. To avoid the aggregation issue, rewrite the calculation using Level of Detail Expressions:

{ INCLUDE : SUM( [measure] ) } / { EXCLUDE [category] : SUM( [measure] ) }


Using the above calculation, it is now possible to aggregate. For example, STDEVP() becomes usable.

Additional Information

A calculation using SUM() is already aggregated.
Did this article resolve the issue?