In this case I end up with a table of brand typologies and way too many different brands associated to the typology and satisfying the filter criteria.
The problem is that in no way do I manage to leave only TOP N brands per BrandTypology.
I've tried using MAX NUMBER but it limits the total number of rows in the table ignoring the BrandTypology dimension. So, unacceptable.
I've tried adding another filter condition to the Brand dimension making it look like this:
=if( aggr(sum(wSampleBrand), BrandTypology,Brand) >= 50 and aggr(max(wAffinityBrand),BrandTypology,Brand) >= 110 and aggr(rank(wAffinityBrand),BrandTypology,Brand) <= 5,
Brand )
But the last aggregation does not take into account the previous conditions (it simply keeps assigning ranks to the brands that do not satisfy previous conditions and are therefore already excluded). So, the result is one BrandTypology has 5 rows, another has 3 rows, still another has just 0 ones. And setting the number from 5 to 7 I suddenly discover a new row appear on the third BrandTypology which previously had 0 rows. That's not a correct TOP N functionality.
I've tried rowno() and noofrows() functions but they do not seem working inside the dimension expression.
I've tried above() function but still with the same negative result.