Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Wiene24
Helper II
Helper II

Rankx

Hi,

 

I have a little problem with my RANKX.

 

Two tables are involved: Costumor and Order

 

I have a measure to calculate the total amount of the orders for each costumor:

Omzet = SUM('dba Dossier'[DBCalcTotaalVerkoopTransport])
 
Now if I want to rank all the costumors, they all give me value 1.
 
I have this measure to calculate the rank:
Omzetplaats = RANKX(ALL('dba Relatie'[DebiteurNummer]);[Omzet])
 
Ranking.PNG
 
DebiteurNummer and RelatieTelefoon are columns in the dba relatie table.
 
When I use calculated columns it works, but I don't want calculated columns because then I can't work with my slicers.
 
Later I want to do more ranks so I can get an average rank, but I only want to use the top 100 costumors based on the total sales.
 
Hope someone can help me, I've been trying to sort it out for a while now but nothing seems to work with measures.
 
Kind regards,
 
Tim Wijnen
8 REPLIES 8
v-lili6-msft
Community Support
Community Support

HI, @Wiene24 

Just try this formula:

Omzetplaats 2 = RANKX(ALL('dba Relatie'),[OMZET] )

or

Omzetplaats 3 = RANKX(ALLSELECTED('dba Relatie'),[OMZET] )

Result:

1.JPG

For your formula, if you just drag [DebiteurNummer] into visual, it will work too.

2.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It's getting closer, but not working completely yet!

 

Rank verschil.PNG

 

I'm using this formula now: 

Omzetplaats = RANKX(ALL('dba Relatie');[Omzet];;DESC)
 
I want the rank to change if I change my slicers, that's why I didn't use ALLSELECTED.
 
But no idea why it leaves gaps now and why some are ranked as equals.
 
Kind regards,
 
Tim Wijnen

 

Anonymous
Not applicable

Hi @Wiene24 ,

 

I am curious to know if the Ranks which shows equals have the same Debit number. this could be the reason it is causing you the equal ranks.

 

Also try the solution provided by Lin @v-lili6-msft , looking at her results , looks like thats what you may be looking for.

 

Thanks,

Tejaswi

hi, @Wiene24 

If you want the rank to change if you change my slicers, please use ALLSELECTED instead of ALL.

don't use Omzetplaats = RANKX(ALL('dba Relatie');[Omzet];;DESC)

 

If you still have problem, please share a simple sample pbix file.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft @Anonymous ALLSELECTED gave me the same result as ALL

 

All the debtornumbers are unique so that can't be the problem either.

 

How do I add a PBIX file? I don't see the paperclip sign to add it.

hi, @Wiene24 

You can upload it to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @Wiene24 ,

 

Try this mesaure:

Omzetplaats = 

                     RANKX(

                                 ALL('dba Relatie'[DebiteurNummer]),

                                   [OMZET],

                                    ,ASC

                                  )

 

 

Thanks,

Tejaswi

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors