The dimension values in your advanced aggregation will be sorted by load order, not by the sort order you define in the chart. So using top() function here will not return a correct result in general.
But you can ask for the maximum value, since this is what you want to get anyway,right?
You can probably simplify this expression a bit further, but this one should return a correct result now.
Thanks for your fast reply. It was really close. Yes, you are right: I am looking for the maximum value on the field “Amount” regarding to the field “Class”. I tried your expression. The result for “Category B” fits correctly, but for some estrange reason for “Category A” don’t.
The correct sum for ”Category A” must be 21600 but it returns 21350.
Am I missing something?
Thanks for any idea.