Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Rankx function didn't work well when introduce a column from another table

I have a table visual that shows Rank columnName by countofReports

 

RANKX(ALLSELECTED(Table[ColumnName]),CALCULATE([Count]))

This work fine but when I introduce another column Type from different table, it does work as shown below

how do i fix this

 

  • Anonymous , measure rank is based on row context. So if add any other column than what you used in Rank, Rank it will readjust itself inside that additional column

     

    so you need like

     

    RANKX(ALL(Table[ColumnName], Table[Type]),CALCULATE([Count]))
    
    or
    
    RANKX(summarize(allselected(Table), Table[ColumnName], Table[Type]),CALCULATE([Count]))

2 Replies

  • Anonymous , measure rank is based on row context. So if add any other column than what you used in Rank, Rank it will readjust itself inside that additional column

     

    so you need like

     

    RANKX(ALL(Table[ColumnName], Table[Type]),CALCULATE([Count]))
    
    or
    
    RANKX(summarize(allselected(Table), Table[ColumnName], Table[Type]),CALCULATE([Count]))
    • Anonymous's avatar
      Anonymous
      Not applicable

      I have tried the two measures and it is not working . it returns the same result as my rankx measure. 
      I need it to rank only on Columname in the table visual. help please