Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Partial sum with Aggr()

Hello All,

I have a pivot table as such

Area,     Share Basis,     Time Version,     Value, Category Total

Category is a field which is above Share Basis in the hierarchy, but is not shown in the pivot table..

I want to do an aggregation on Category, Area and Time Version (which can be same across multiple rows) to get the Category total.

I've been using the following formula.

SUM(AGGR(

  SUM([Value]),

  [Category],[Area],[Time Version]

  )

  )

It is not giving the expected result. It is returning a value only for one row and not the others. Is there any way I can do partial aggregations with AGGR() and how do I get the desired result in this scenario?

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try using NODISTINCT like:

SUM(AGGR( NODISTINCT

  SUM([Value]),

  [Category],[Area],[Time Version]

  )

  )

View solution in original post

5 Replies
tresesco
MVP
MVP

Try using NODISTINCT like:

SUM(AGGR( NODISTINCT

  SUM([Value]),

  [Category],[Area],[Time Version]

  )

  )

Not applicable
Author

Thank you.

Thank you very much. It works. But without the SUM.

With the SUM, the numbers are going haywire.

I can get it till the Share Basis, but for Area, I think I might need to look at options or use a set modifier

sunny_talwar

You can also try this

Sum(TOTAL <[Category], [Area], [Time Version]> [Value])

Not applicable
Author

I've tried that. What happened in that situation was a [Category] was not present in the pivot table dimensions, the result was totalling across Area and Time Version, but not for Category. So I have opted to use AGGR() instead of TOTAL

sunny_talwar

How about like this

Sum(TOTAL <[Category], [Area], [Time Version]> Aggr(Sum(Value), AllDimensionsIncludingCategory))