Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi guys
I'm very new to this so I could well be running before I can walk.
I essentially have a table that details suppliers with a monthly performance score.
Can anyone help me with a formula to show the top 10 suppliers by score (so 100% top) and then sorted by their number of jobs (high to low) please?
I've tried numerous methods from Googling but none have yielded the desired result.
The table is called Supplier Master and the column headings are Supplier, Overall Score and Jobs Raised.
Many thanks in advance,
Gareth
Solved! Go to Solution.
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.
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
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.
Regards,
Charlie Liao
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
Yes it would be nice if RANKX could actually use another [Measure] to break the ties!
User | Count |
---|---|
123 | |
69 | |
67 | |
58 | |
52 |
User | Count |
---|---|
182 | |
86 | |
67 | |
62 | |
53 |