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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors