Forum Discussion

LucasFERR's avatar
LucasFERR
New Member
4 years ago
Solved

RANKX Power BI - Repeating

Hi, i'm having some trouble using HANKX, i'm trying to rank a table based on a column, This column is a sum between as points and RAND()*0.01, so i don't have any repeated value.

this is the formula im using:

 

ranking = RANKX(fto_resultados,fto_resultados[Pont+rand])

 

When i insert this measure in a table, it just return the the number one and repeat for every line.

Also tried using ALL an ALLSELECTED but did't worked as well

  • Hi Lucas:

    Here are two measures that can work for one column and second one considering two columns from the same table: I will picture the table below. One or both of these should work. My table named used is 'TableRank'. I hope this provides your solution!

    Rank EQ = RANK.EQ(TableRank[Stock],TableRank[Stock],DESC)
    Part RankX = RANKX(FILTER(all(TableRank),
    TableRank[Store]=EARLIER(TableRank[Store])),TableRank[Stock])

     

     

3 Replies

  • Hi:

    Can you try using a pattern such as: (Here is an example for ranking customers by net sales). Where Sales_Data is the Fact Table and Customers is Dimension table and Customers[Serach Name] is being ranked for net sales. I can't see your other tables,so I hope this helps!

    Rank_Cust by Region =

    IF([Net Sales] > 0,

    RANKX(

        CALCULATETABLE(

              SUMMARIZE(Sales_Data, 

              Customers[Search Name]),

              ALL(Customers[Search Name])

        ),

      [Net Sales],

                 ,

                 DESC

    ))

    • LucasFERR's avatar
      LucasFERR
      New Member

      I tried to do something like you did, but i stil getting the same result, in my case, both columns that i whant to analize are in the same table, is it supose to work difrently?

      • Whitewater100's avatar
        Whitewater100
        Icon for Solution Sage rankSolution Sage

        Hi Lucas:

        Here are two measures that can work for one column and second one considering two columns from the same table: I will picture the table below. One or both of these should work. My table named used is 'TableRank'. I hope this provides your solution!

        Rank EQ = RANK.EQ(TableRank[Stock],TableRank[Stock],DESC)
        Part RankX = RANKX(FILTER(all(TableRank),
        TableRank[Store]=EARLIER(TableRank[Store])),TableRank[Stock])