Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I need an help with Aggr count, I have attached a sample & explained my requirement.
Thanks In Advance
You cannot break out of the dimension context (Brand).
Maybe the only solution is a precalculation of this figure as @nmartin wrote...
This seems to do the trick.
sum(aggr(count({<"BRAND ID"=>} total <"ACCT"> distinct "BRAND ID"),"BRAND ID","ACCT"))
Edit: Added set analysis to fix bug where if you selected a single row, the value changed.
This is brilliant John!
How can this count work with a different dimensionality?
Thanks John... Perfect that's what I am looking for....
@TIQView - Ralf Becher wrote:
How can this count work with a different dimensionality?
Well, ignore the sum(), replace the aggr() with a table, and get rid of the set analysis for the moment. That gives us this hopefully more understandable case:
dimension 1 = BRAND ID
dimension 2 = ACCT
expression = count(total <"ACCT"> distinct "BRAND ID")
That's exactly how I started. Now, I wasn't certain it would work, but I thought it might, and it did. What seems to be happening is that since we have account after brand in the dimensions, we only look at the accounts for the brand for that row. However, in the count(), we tell it 'total <"ACCT">', which says to ignore the brand. It ends up paying attention to the brand for the selection of accounts, but then ignoring the brand for the count of brands. That's exactly what we needed. Then it's just a matter of converting this temporary table into an aggr() by putting our two dimensions in the aggr(), summing up, and finally using set analysis to make sure that when we select one specific brand, it doesn't only count that brand.