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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
JellyFishBi
Helper I
Helper I

Ranking changes when applying filters

Good Evening Folks.  My Problem with RANKX is that It ranks my list just fine as shown:
Rankx Before.png
BUT When I filter by a Provider, "Reem" in this case, His rank drops to 2 as shown.
Rankx After.png
My Formula is:

RankProdHr = IF (
    HASONEVALUE (
        BizLine[ProvName] ),
    RANKX(
         ALL (
             BizLine[ProvName]),NetProd[Prod/Hr]))

Any help would be appreciated.  I have adjusted this formula to exclude HASONEVALUE, i've included dense, skip.  All produce the same behavior...


Thanks,

Mike









1 ACCEPTED SOLUTION

Hi,

This measure solves the problem

RankProdHr = IF(HASONEVALUE(BizLine[ProvName]),RANKX(ALLSELECTED(BizLine[ProvName]),[Prod/Hr]))
Hope this helps.
Untitled.png

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

16 REPLIES 16
Ashish_Mathur
Super User
Super User

Hi,

Assuming Prod/hr is a measure, try this

RankProdHr = IF(HASONEVALUE(BizLine[ProvName]),RANKX(ALL(BizLine[ProvName]),[Prod/Hr]))

If it does not help, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

This measure solves the problem

RankProdHr = IF(HASONEVALUE(BizLine[ProvName]),RANKX(ALLSELECTED(BizLine[ProvName]),[Prod/Hr]))
Hope this helps.
Untitled.png

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This did not solve the core issue.... why marked as solution?

Looks Great.  Thank you.  Why did we need allselected?

 

You are welcome.  To pay heed to the specific Clinic names chosen in the slicer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

 

New Problem has arisen.  When I select any other provider with the slicer, they all are ranked 1.  I need them to maintain their rank when filtered by slicer.  How to cope with this?

 

Man thanks,

Mike

 

Cannot understand.  Show the exact problem and also the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for the response.

 

As you can see, the provider Rubis is ranked 2 prior to any filtering and then when filtered to his name, he is ranked 3.

 

Rubis Before.JPG

Rubis After.JPG

 

Afer Filtering, His rank Increases to 3.

I Would like his rank to maintain the rank of 2. 

 

My Current formula for this is: 

RankProdHr = IF(HASONEVALUE(BizLine[ProvName]),RANKX(ALL(BizLine[ProvName]),[Prod/Hr]))
 
Using ALLSELECTED returns the Rank to 1 when filtered which is not the desired outcome.
 
My thanks.
 
 

 

 

 

Hi,

Try this measure

=IF(HASONEVALUE(BizLine[ProvName]),RANKX(CALCULATETABLE(ALL(BizLine[ProvName]),ALLSELECTED(BizLine[ClientName])),[Prod/Hr]))

If it does not, share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

https://drive.google.com/file/d/1DnCfpNOUR6x1u22aQYxAuePcfR4_6t-N/view?usp=sharing

 

Sorry, here is the link.  Thank you so much for looking into this.

 

Mike

I am quite sure my formula there is correct.  It may have to do something with the relationships.  There are way too many relationships to review/check there.  Someone else will help you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you,  I have created a watered down, three table version of the report.  Here is the link.

https://drive.google.com/file/d/1ZCaqeH3AAStNF-vmf9RV52lfSsRilqJV/view?usp=sharing

 

Again, the issue here is in the rank list, all is good.
Patel BeforePatel Before

When I select Patel, her rank falls to 11.
Patel AfterPatel After
I hope you can help.

Many thanks,

Mike
@Ashish_Mathur 





 

 

 

 

 

 

 

 

 

Hi,

I am sorry but i am unable to identify the cause.  I tried but could not succeed.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 
I can send the file again.  Do you still have it from yesterday??

 

 

Hi - By any chance did you ever find a solution to this problem?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors