Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

RANKX issue

Hi all,

 

Got an issue with RANKX.

Here is my data model :

 

1 Fact table : Sales

2 dimensions tables : Calendar, stores

 

I want to create a measure to have store's rank over turnover.

 

I created measure Indicateurs[CA TTC] : SUM('Daily Sales N'[MNT_TTC]) => Sum(TurnOver)

And finally my RANKX = rankx(all(Stores),Indicateurs[CA TTC],,DESC)
 

Here is the result :

 
 
 
 
 
 
 
 
 
 

 

  • Hi Anonymous ,

     

    You can use the following  measure in your table visual:

     

    Rang CA BU Mois Filtre = var a = SUMMARIZE(ALL(Stores),Stores[Magasin],"CA TTC",[CA TTC Mois],"rank",RANKX(ALL(Stores),CALCULATE([CA TTC Mois],ALLEXCEPT(Stores,Stores[Magasin])),,DESC)) return SUMX(FILTER(a,Stores[Magasin] = MAX(Stores[Magasin])),[rank])

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai

14 Replies