Forum Discussion
Tsoltvedt
3 years agoRegular Visitor
TableSorter Custom Power BI Visual - Rankings
I'm using the Table Sorter visual to rank entries based on a score. For entries that have the exact same score the tool defaults to ranking based on alphabetical order. Is there a way to change this ...
amitchandak
3 years agoSuper User
Tsoltvedt , Not sure on table sorter, But we usually use rank measure for rank
examples
Rank Discount % = RANKX(all("Item"[Category]),[Discount %],,DESC,Dense)
Rank Discount % (Brand) = RANKX(all("Item"[Brand]),[Discount %],,DESC,Dense)
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
Tsoltvedt
3 years agoRegular Visitor
Many thanks for the reply. I have tried RANKX but the challenge I'm facing is that all the entries end up being ranked as 1. The table has four columns: 'Country', 'year-quarter', 'index', and 'score'. I'm trying to rank the countries based on their score for a specific index and year-quarter. I have tried the formula below but all countries end up ranked as 1:
RANKX(
FILTER(
'Global Indices R1',
'Global Indices R1'[Year-Quarter] = SELECTEDVALUE('Global Indices R1'[Year-Quarter])
&& 'Global Indices R1'[Index name] = SELECTEDVALUE('Global Indices R1'[Index name])
),
CALCULATE(
MAX('Global Indices R1'[Score]),
ALLEXCEPT('Global Indices R1', 'Global Indices R1'[Country Name])
),
,
DESC
)