# Using PowerPivot to subtotal a calculated measure



## cr731 (Jan 23, 2015)

I have a calculated measure that is basically an IF statement on each line saying,

IF budget > target, return budget, else, return target

This works, but when I get to the grand total, I want it to be the sum of all lines above, not to perform that operation on the grand total row itself, if that makes sense.

I've gathered this isn't possible in a normal pivot, but how can I write a calculation in Powerpivot that does this?


----------



## scottsen (Jan 26, 2015)

=SUMX(VALUES(YourTable[TheColumnYouHaveOnRows]), [YourIfMeasure])


----------

