Reputation: 11
How I can find percentage out of subtotals with multiple columns in Pivot table.
PercentYes :=
CALCULATE ( SUM ( MyTable[value] ), MyTable[answers] = "yes" ) /
CALCULATE (
SUM ( MyTable[value] ),
ALL ( MyTable[subcategory], MyTable[answers] )
)
Upvotes: 0
Views: 382
Reputation: 106
I created a sample of values
I would first create a sum measure:
Sum of Values:=SUM(MyTable[Value])
Then, I would create the percentage measure:
Percent of Values :=
DIVIDE (
[Sum of Values],
CALCULATE (
[Sum of Values],
ALL ( MyTable[Subcategory],MyTable[Answers] )
)
)
Using DIVIDE will help with error trapping zeroes in the denominator. The result looks like this:
Upvotes: 1