Forum Discussion
Anonymous
5 years agoNot applicable
Rank based on multiple columns in matrix
Hello team,
I have a Brand & product column in heirarchy in matrix visual along with sales I want rank based on Brand If visual is not expanded and if visual is expaned then it should return rank based on product. I also have slicers on the page.
It should not have ties, My dataset has around 14 million rows so COUNTROWS doesn't seem to work.
rankpro = IF(ISINSCOPE('Product Attributes'[Brand-Product]),RANKX(ALLSELECTED('Product Attributes'[Brand-Product]),[Sellout (P)],,DESC,Dense))
But it is returning ties.
1 Reply
- AnonymousNot applicable
Total Sales = SUM( Sales[Amount] ) Ranking = switch( TRUE(), ISINSCOPE( Products[Prod Name] ), var ProductsForRanking = CALCULATETABLE( DISTINCT( Products[ProductID] ), DISTINCT( Products[Brand] ), ALLSELECTED( Products ) ) var Rank_ = RANKX( ProductsForRanking, CALCULATE( [Total Sales], ALLEXCEPT( Products, Products[ProductID] ) ), [Total Sales], DESC,Dense ) return Rank_, ISINSCOPE( Products[Brand] ), var BrandsForRanking = CALCULATETABLE( DISTINCT( Products[Brand] ), ALLSELECTED( Products ) ) var Rank_ = RANKX( BrandsForRanking, [Total Sales],, DESC,Dense ) return Rank_ )