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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
poojithas
Helper III
Helper III

RANKX with visual filters

Hi All,

I have a requirement to show top 20 values in a table.

For that I have used RANKX function. Code below.

 

poojithas_0-1680592341659.png

This gives me the correct ranking based on the field volume. 

poojithas_1-1680592342280.png

But, after I apply Top 20 filter, the ranking is incorrect. The Ranks are repeated and the values are not in the expected order. 

poojithas_0-1680601956811.png

This is happening due to the RL12 filter.

  poojithas_2-1680602022273.png

 

 I am only including data where RL12="Y". There are other visual filters as well.
So, where ever there are no records for RL12=Y, the rank is getting skipped.

Could someone please suggest on how this can be fixed and show all the ranks in order without any repetition.

Thank you

Poojitha

7 REPLIES 7
tamerj1
Super User
Super User

Hi @poojithas 
Try by replacing ALL with ALLSELECTED

@tamerj1  : Tried ALLSELECTED as well, and the results are same as ALL. 

The results are not as expected

@poojithas 
Ok. Please try

Rank =
RANKX (
    CALCULATETABLE (
        SUMMARIZE ( NTN_GRAPHS, NTN_GRAPHS[GRANDPARENT], NTN_GRAPHS[GRANDPARENT] ),
        ALLSELECTED ()
    ),
    [Volume (k1)]
)

@tamerj1  : Thanks for the quick response. I have tried the above logic and the results are again same as before . Please find the screenshot below:

poojithas_0-1680608874443.png

 

@poojithas 

What is the DAX of [Volume (k1)]?

@tamerj1 
There was a visual filter for the field "Type" where the logic was concatenate(comments,ntn/non-ntn) and this had the output as below: I was restricting this to only show Regular NTN and Premium NTN.

Regular NTN
Regular Non-NTN
PremiumI NTN
Premium Non-NTN
Non-Premium NTN
Non-Premium Non-NTN

I created another column with the logic as if type=Regular NTN and Premium NTN then include else exclude. I used this field instead of TYPE in the visual filter. This fixed the issue with Ranking.
Thanks for the responses.

@tamerj1 : It is volume *0.001

poojithas_0-1680611403512.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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