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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
akj2784
Post Partisan
Post Partisan

Max of 3 records and filter the max

Hi All,

 

I have a requirement to pick the max of % for 3 records and filter the same record.

For the below set of records, I have to pick the 8.33% record. So the report should show only 3rd record.

Please let me know if there is any way to do this. 

Scenario.JPG

7 REPLIES 7
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @akj2784,

 

If [Metric2/Metric1*100] is a column, please create a rank value with below measure:

Rank =
RANKX (
    ALLSELECTED ( Sheet1 ),
    CALCULATE ( SUM ( Sheet1[Metric2/Metric1 *100] ) ),
    ,
    DESC,
    DENSE
)

 

While if [Metric2/Metric1*100] is a measure, please modify the rank measure as below:

Rank =
RANKX (
    ALLSELECTED ( Sheet1 ),
   Sheet1[Metric2/Metric1 *100] ,
    DESC,
    DENSE
)

Add the [Rank] measure to visual level filter, and set its value to 1.

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you. I will give it a try and let you know.

Rank =
RANKX (
    ALLSELECTED ( Sheet1 ),
   Sheet1[Metric2/Metric1 *100] ,
    DESC,
    DENSE
)

This gives error. But when put the same column in the value part of the syntax it assigns the same rank for all records.

I assume sheet1 would be the table which has the % column on which we want to calculate rank.

 

I think Allselected part is not working somehow for me. If I remove that and just gives the table name it ranks all the data. 

Would you be able to pass on the sample pbix file ?

 

Also is it working fine if we filter on rank as 1 ? 

Hi @akj2784,

 

I have uploaded the .pbix file for your reference.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This works fine in your file. But we have metric coming from different table and there are 4 other tables involved in this. So when we put ALLSELECTED(TABLE which has metric), it splits the records in lower grain and doesnt rank properly.

Hi @akj2784,

 

Could you please illustrate your scenario with more information?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.