Forum Discussion
Ranking help please
- 10 years ago
Hi EL_lloydie,
According to your description, you need to background sort them by score and get the top 10 suppliers, and display them order by jobs raised, right?
I have tested it on my local environment, the steps below is for you reference.
- Click Edit Queries > Edit Querie
- Click arrow in Overall Score column > Sort Descending
- Click Keep Rows > Keep Top Rows, type 10 in the Number of rows textbox.
- Click Close & Apply button
- Create a calculated column using the DAX below.
Rank = RANKX(Supplier,Supplier[Job Raised]) - Then display the data on the visuals.
Regards,
Charlie Liao
There is RANKX function in DAX. You can use that to Rank.
ADD a new Column in your table . Lets Say we call it as Rank
Rank = RANKX(ALL(Table),MonthlyPerformanceScore,Number of Jobs)
I hope this works
BR
Achin
Thanks Achin
It sort of works, only I can't understand the rankings!
Below is my data (admittedly, sorted by score (high to low).
I need it to background sort them by score (high to low) and then by jobs raised (so that it goes high to low). Then the supplier at the top would be ranked 1, the next supplier would be 2 and so on.
Thanks,
Gareth
- waltheed10 years agoImpactful Individual
The result of DAX queries is never sorted. You have to do that in your client tool.
The sorting in your table screenshot may look strange because you do not show the decimals?
Also note the last argument of the RANKX function, which defines how to deal with ties.
The approach is good.
Add a column with rank, call it Ranking:
=RANKX(ALL('Supplier Master');[Overall Score];;DESC;Dense)
Do your query (not sure where you are creating the table, but you could do it like this, e.g. with the DAX Studio add-in for Excel):
evaluate
topn(10,'Supplier Master',[Ranking],ASC)
order by [Ranking] ASC, [Jobs Raised] DESC
- Sean10 years agoCommunity Champion
Yes it would be nice if RANKX could actually use another [Measure] to break the ties!
- v-caliao-msft10 years agoMicrosoft Employee
Hi EL_lloydie,
According to your description, you need to background sort them by score and get the top 10 suppliers, and display them order by jobs raised, right?
I have tested it on my local environment, the steps below is for you reference.
- Click Edit Queries > Edit Querie
- Click arrow in Overall Score column > Sort Descending
- Click Keep Rows > Keep Top Rows, type 10 in the Number of rows textbox.
- Click Close & Apply button
- Create a calculated column using the DAX below.
Rank = RANKX(Supplier,Supplier[Job Raised]) - Then display the data on the visuals.
Regards,
Charlie Liao