Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Rank

Hi

 

I am having one column in table named [MeasureId] and [Earnings] is the Calculated measure. I have calculated Rank of Earning using RANKX function but for last 5 rows [Earnings] is same and that's why Rank for those rows is coming out to be same. Is there any way to showo Rank after 6th rows as 7,8,9,10

 

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    RANKX will return the same ranking for the same value, this is by design and it is the correct behavior.

    In your scenario, please use the following DAX to work around this issue.

    1.Create a summarized table using DAX below.

    Table = SUMMARIZE(Table1,Table1[Measure[MeasureId]]],"NewEarning",[Earnings])

    2. Then create a column using DAX below in the new table.

    Rank = 
    RANKX ('Table',
        RANKX ('Table',
            'Table'[NewEarning],
            ,
            ASC
        )
            + DIVIDE (
                RANKX (
                        'Table','Table'[Measure[MeasureId]]],
                    ,
                    ASC
                ),
                
                    COUNTROWS (
                        
                            'Table'
                        )
                    
                        + 1
                )
            )
    



    Regards,
    Lydia

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Lydia

       

      I am confused anout this "NewEarning". I do not have this in my database. Can you please elaborate ho wit will work.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous,

        It is a column in the new table, you would need to firstly create a summarized table using DAX below.

        Table = SUMMARIZE(Table1,Table1[Measure[MeasureId]]],"NewEarning",[Earnings])


        Regards,
        Lydia