How to Filter Top 10 in Power BI
Showing your “top 10” performers is one of the most common and effective ways to make a report easier to understand. Whether you're tracking the top 10 products by sales, top 10 campaigns by conversions, or top 10 salespeople by revenue, this filter cuts through the noise and helps your audience focus on what matters most. This tutorial will walk you through the two main ways to create a Top 10 filter in Power BI: the simple drag-and-drop Filters Pane method and the more powerful approach using a DAX formula.
Why Bother with a Top 10 Filter?
Before we jump into the "how," let's quickly cover the "why." By default, a chart showing every single product, country, or sales representative can quickly become cluttered and unreadable. A "Top N" filter (where 'N' is 10, 5, or any number you choose) instantly improves your dashboards by:
- Reducing Clutter: Hiding low-performing items makes your charts cleaner and easier to read.
- Focusing Attention: It immediately draws your team's focus to the highest-impact items that are driving your results.
- Improving Performance: Limiting the amount of data a visual has to render can sometimes help your report load faster.
It's a foundational skill for anyone looking to build clean and insightful reports. Now, let’s get into the practical steps.
Method 1: The Easy Way with the Filters Pane
For most situations, the built-in filtering tools in Power BI are more than enough. This approach is perfect for beginners because it requires no code and you can set it up in under a minute.
Let's use a common example: you have a simple bar chart showing total sales by product name and you want to show only the 10 best-selling products.
Step-by-Step Instructions
Here’s how to apply a Top 10 filter using the Filters pane.
1. Select Your Visual
First, click on the visual you want to filter. This could be a bar chart, a table, a matrix, or almost any other visual in your report. When selected, you'll see a border appear around it, and the data fields used in that visual will be highlighted in the "Visualizations" and "Filters" panes.
2. Open the Filters Pane
By default, the Filters pane is located to the right of your report canvas. If you don't see it, go to the View tab in the main ribbon and make sure the "Filters" checkbox is checked. You'll see an area called "Filters on this visual," which is where you'll do your work.
3. Set Up the Filter Condition
In the "Filters on this visual" section, you should see the fields that are already being used in your chart (like 'Product Name' and 'Sales').
- Click on the field you want to filter and rank. In our example, this is the 'Product Name' field. This expands the filtering options for that field.
- Under "Filter type," click the dropdown that says "Basic filtering" and change it to Top N.
4. Configure the Top N Filter
Now you just need to tell Power BI what your Top 10 is based on.
- In the Show items section, keep the setting as "Top" and enter the number 10 into the box next to it. (You could also use "Bottom" if you wanted to find the 10 worst-performing items).
- The crucial step is the By value box. You need to drag the measure that determines the ranking into this box. For our example, we want to find the products with the highest sales, so we'll drag our 'Sales Amount' measure into this box.
- Once the measure is in the box, click the Apply filter button.
Instantly, your chart will refresh to show only the 10 products with the highest sales volume. It's that easy. This method is incredibly quick for creating focused dashboards.
Method 2: The Flexible Way with a DAX Rank Measure
The Filters Pane method is great, but sometimes you need more power and flexibility. What if you wanted to display the rank number next to each product in a table? Or what if you needed to use that rank in another calculation? That's when you turn to DAX (Data Analysis Expressions).
For this approach, we'll use the RANKX function to create a new measure that calculates the rank of each item. Then, we'll use that measure to filter our visual.
When Should You Use DAX for This?
- You want to show the rank for each item (e.g., #1, #2, #3...).
- You need precise control over how to handle ties (e.g., if two products have the same sales).
- You plan to use the rank itself as part of another DAX calculation.
- You're building a more complex model where dynamic filtering is needed.
Step-by-Step Instructions
This process has two parts: first creating the rank measure, and then using it to filter a visual.
1. Create a New Measure for the Rank
Go to your 'Data' or 'Report' view. In the ribbon at the top, click on New Measure. This will open up the DAX formula bar.
2. Write the RANKX Formula
Now, enter the DAX formula to calculate the rank. The RANKX function is the workhorse here. For our example of ranking products by sales, the formula would look like this:
Product Sales Rank =
RANKX(
ALL('Products'[Product Name]),
CALCULATE(SUM('Sales'[Sales Amount])),
,
DESC,
Dense
)Let's quickly break down that formula:
RANKX(...): This is the ranking function.ALL('Products'[Product Name]): This tells Power BI on which list to rank the items (in this case against all products in the [Product Name] table). If you don't useALL(), the formula will rank each product against just itself, and everything would have a rank of #1!CALCULATE(SUM('Sales'[Sales Amount])): This is the value that determines the rank. Here, we're calculating the sum of sales for each product., , DESC, Dense: These are optional parts of syntax.DESCmeans we want number 1 to be the highest value of sales, so the ranking will be descending (from large number to small). The blank space between two comma-separated parts indicates default behavior that's being left unchanged here.
3. Add the Rank Measure to a Visual
To check that your new measure is working, create a table visual. Add your 'Product Name', 'Sales Amount', and your new 'Product Sales Rank' measure to it. You should now see a table of all your products with their corresponding sales and a rank number beside each one.
4. Filter the Visual Using Your New Rank Measure
With the rank measure created, filtering to the Top 10 is easy.
- Select the visual you want to apply the filter to and make sure the "Filters" pane is visible, including the filter section applicable to the visual. If not, ensure the "Filters" option is checked in the view settings.
- In the "Fields" pane in the visualization panel, select the newly created measure and drag it into the "Filters" pane.
- In the drop-down menu, under "Show items when the value:" type, choose "Top N." Enter "10" to display the top 10 items. Click "Apply."
You’ve achieved the same result as the Filters Pane method, but now you have a reusable measure that lets you show rank values directly in your charts, providing more context and flexibility for future reports!
Which Method Should You Use?
For most dashboards, the Filters Pane approach is fast, intuitive, and meets basic Power BI tasks. If you just want to show a quick bar chart with the top-selling items, this will almost always get your job done quickly.
However, there are cases where more sophisticated ways to present information in reports are necessary, such as displaying rank value or calculating changes over time. In these cases, investing time in writing a DAX measure with RANKX is invaluable for the flexibility it provides.
Final Thoughts
Mastering the art of a Top N filter is a crucial skill for efficiently using Power BI. It makes dashboards less chaotic, helping users understand what the data conveys. Whether choosing a simple filter pane or utilizing a more flexible DAX formula depends on the specific needs of each project. Building these powerful reports can be an incredibly rewarding experience, but sometimes you just need a fast solution and a quick answer without needing to delve into filters panes or writing DAX.
We created Graphed to solve exactly these kinds of procedures. Instead of having to set up a manual Top Filter, you can simply ask "Show me the top 10 campaigns by the most leads from these on my site this last month," and have a live, interactive dashboard which does exactly what you just asked in seconds. Isn't this much better?
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.