If you want to nest aggregations, i.e. calculated the sum of another sum, then you need to use the aggr function and specify over which dimensions the inner sum should be aggregated. I don't understand what you're actually trying to do. Can you prepare an example document with some data and the results you expect?