Your problem description let me assume that the issue is related to the implicite DISTINCT qualifier of the aggr() function, so you might want to try an explicite NODISTINCT.
Though this might result in showing some numbers for each dimension value, the actual resulting numbers might be wrong.
Without knowing your specific data model, dimensions, expressions and requirements, it hard to tell more for now.
Another suggestion: Use pick() function instead of multiple embedded if() statements, like
That's right. I found that out just trying a couple of things without really knowing what I'm doing. Using the NODISTINCT that works very well. Although I have to ressearch if the results are indeed OK. But I have no idea what the difference is between the default and the NODISTINCT aggregations.
Thanks for the tip about the pick() function!
A question about this:
If the expression argument is preceded by the nodistinct qualifier, each combination of dimension values
may generate more than one return value, depending on underlying data structure.
(from the reference guide)
With 'combination of dimension values', do they mean the dimension of the chart on the one hand and the dimension of the aggr() function on the other?