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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
chestercas
Helper I
Helper I

RANKX : different result on different graph

HI,


I don't understand what is happening with my RANKX function.
I rank different zone by result (different calcul).
I do a table (down) and a Card (Up).
On the exemple, we can see all the results are right (on the left). Zone "SUD EST" is 5th.
But on the right, the table told me SUD EST is 1st, and the card graph told me 2nd... It's the same measure...
All the filters are right.
There is my RANKX measure : 

Rank prod = RANKX(FILTER(ALL(DATA_BRMC[Zone]),DATA_BRMC[Zone]="AG IDF" || DATA_BRMC[Zone]="AG NORD EST" || DATA_BRMC[Zone]="AG OUEST" || DATA_BRMC[Zone]="AG SUD EST" || DATA_BRMC[Zone]="AG SUD OUEST"),[Prod / h log])
capture 2 PBI.PNG
I have 5 graph with different calcul (based on the same measure for rank). 2 are false and 3 are right.
I can't explain why... And I tried many things...

Can you help me ?

Thanks a lot,
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @chestercas ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1686102996873.png

(2) We can create a measure. 

Rank prod = 
var _a=RANKX(ALL('DATA_BRMC'),'DATA_BRMC'[Prod/h log],MAX('DATA_BRMC'[Prod/h log]),DESC,Dense)
var _b=IF(ISFILTERED('DATA_BRMC'[Zone]),_a,BLANK())
return _b

(3) Then the result is as follows.

vtangjiemsft_1-1686103042982.pngvtangjiemsft_2-1686103068667.png

Note that this measure needs to be used with slicers when placed on a card visual, and if you only want to show the rank of [AG SUD EST], create a measure like the following and place it on the card visual.

AG SUD EST rank = CALCULATE('DATA_BRMC'[Rank prod],FILTER(ALL('DATA_BRMC'),'DATA_BRMC'[Zone]="AG SUD EST"))

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @chestercas ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1686102996873.png

(2) We can create a measure. 

Rank prod = 
var _a=RANKX(ALL('DATA_BRMC'),'DATA_BRMC'[Prod/h log],MAX('DATA_BRMC'[Prod/h log]),DESC,Dense)
var _b=IF(ISFILTERED('DATA_BRMC'[Zone]),_a,BLANK())
return _b

(3) Then the result is as follows.

vtangjiemsft_1-1686103042982.pngvtangjiemsft_2-1686103068667.png

Note that this measure needs to be used with slicers when placed on a card visual, and if you only want to show the rank of [AG SUD EST], create a measure like the following and place it on the card visual.

AG SUD EST rank = CALCULATE('DATA_BRMC'[Rank prod],FILTER(ALL('DATA_BRMC'),'DATA_BRMC'[Zone]="AG SUD EST"))

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

chestercas
Helper I
Helper I

I analysed my database, and I think the filter on measure is not apply (it add the "no ref" value").
I tried to change "rank prod" measure, but not working... 😞


Thx

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors