Show only the top 3 with IF and RANKX

Blank out everything below third place so a chart or matrix highlights just your best sellers.

You will learn to

  • Use a rank as a condition inside IF
  • Return blank to hide rows from a visual

How it works

A rank is just a number, so you can test it. `IF(condition, value)` returns the value when the condition is true, and **blank** when it’s false, because the third argument is optional.

Power BI hides rows where every measure is blank. So a measure that returns sales for the top three products and blank for the rest turns any visual into a top 3 view, with no visual filter needed.

The rank inside the condition follows the same rules as before: rank over `ALL(Product)` so each product is compared with all of them.

Practice it hands-on with a real data model and a live report that updates as you type.

Bottom 3 Sales = IF(RANKX(ALL(Product), [Total Sales], [Total Sales], ASC) <= 3, [Total Sales])