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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
NB_Data
Regular Visitor

Ranking issue when filtering

Hi,

 

I'm running into an issue when using the RANKX function within a table, and then filtering that table. Unfiltered, it works great, no issues with the actual ranked output field/column. But then if I filter the table for a particular hospital/institution it returns a completely wonky rank. I'm also having the rank for a particular hospital displayed in a card and it of course returns the same errant rank number.

[I've removed the hospital/institution names from the images below]

 

Unfiltered:

Discharge table1.jpg

 

 

Filtered for that one hospital/institution above, that showed a rank of #8, it now shows #5, and the "% of Hosp Discharges" and "Sum Hosp %" also changed:

 

Discharge table2.jpg

 

The measure for "DischargeRank Hosp.":

 

Discharge table3.JPG

 

Appreciate the help in advance! This one has had me stumped!

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @NB_Data 

Thanks for reaching out to us.

You can try to replace all() with allselected(), as there is no sample data to test, not sure if it works, just try it.

vxiaotang_0-1651642964015.png

 

Best Regards,

Community Support Team _Tang

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

johnt75
Super User
Super User

Use Performance Analyzer to get the queries used both with and without filtering for an individual institution and compare them both in DAX Studio. It may be that some additional columns are being filtered beyond what you explicitly specify, e.g. a sort by column.

Once you know which columns are being filtered you may be able to alter your measures to factor that in.

amitchandak
Super User
Super User

@NB_Data , Sum of discharge should not change with the filter for hospital/institution 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak , unfortunately I can't easily create a de-identified dummy pbix to work with. The first screenshot is in table/matrix format, with institution and discharges being fields from the dataset, and the others being measures.

 

I can't be the only one that's experienced this table/matrix filtering issue.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors