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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
alportela
New Member

RANKX results x Slicer Results

Hello guys.

I bet it is a simple fix, but I can't quite figure it out.

So I have the Rankx:

Ranking categoria = RANKX(ALL(Folha[Categoria]),[Vantagem])

alportela_0-1638320894052.png

Everything works fine so far.

However, when I use the slicer, the ranking order changes. For example: the "aposentados" goes from 2nd to 3rd place as shown below:

alportela_1-1638321239766.png


Any help?





 

1 ACCEPTED SOLUTION

@alportela 

TBH, nothing mate.

I changed the method, and used calculated columns rather than Measure.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

View solution in original post

10 REPLIES 10
VahidDM
Super User
Super User

Hi @alportela 

 

Is [Vantagem] a measure? or column name? if it's a measure can you share a formula with a sample of your data?

 

BTW, try this:

Ranking categoria = RANKX(ALL(Folha),[Vantagem])

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hello.
Sorry, it is my first post.
[Vantagem] it is a measure.

 

Vantagem = SUMX('Folha',[Fixa]+[Eventual]+[Função]+[Cet]+[Variável]+[Indenização])

 


I tried your suggestion, but it did not work

 

 

Ranking categoria = RANKX(ALL(Folha),[Vantagem])

 

alportela_0-1638322083616.png

Sample data: http://bit.ly/alpimprimir

 

@alportela 

 

Do you use columns from one table in matrix and slicer?

I think your first dax code should works fine unless there is something that is not clear here. Can you share your PBIX file?

 

download this file: https://gofile.io/d/F9woxk

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Sure.
There you go: https://gofile.io/d/BqacsT

Check this file:

 

Download link: https://gofile.io/d/To94by

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Awesome, man. It works. Thanks a lot.

What did I do wrong?

@alportela 

TBH, nothing mate.

I changed the method, and used calculated columns rather than Measure.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

@alportela I checked the file and it looks to me like this is a floating-point accuracy error rather than anything wrong with the DAX.

 

As a workaround, you can fix the problem by rounding using INT.

 

Ranking categoria = RANKX ( ALL ( Folha[Categoria] ), INT ( [Vantagem] ) )

 

As a side note, I'd recommend using calculated columns for ranking unless the rank needs to be dynamic (which is rather common).

 

It does not affects performance?

Well, in a simple way, Measure use CPU and Calculated Column use Ram [memory] 🙂
If you use Calculated column that will increase your file size az well.

 

In you file it's not different (it's not a big [1GB or more])

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.