You calculate a sum of sums. I don't know why, but that's what you're doing. Are you perhaps using this expression a pivot table? Anyway, if you nest aggregation functions then you need an aggr to create an intermediate virtual table with the lower level sums. These are then summed by the outer sum. Possibly you don't need the set modifiers in the outer sum.