How to Show Top 10 in Power BI Bar Chart

Cody Schneider••9 min read

A crowded bar chart can be more confusing than helpful, making it difficult to spot what's actually important. Filtering your chart to show only the top performers, like your top 10 products or highest-performing campaigns, is a simple way to bring focus to your data story. This tutorial will walk you through two effective methods in Power BI to create a "Top 10" bar chart - one simple click-based approach and a more dynamic DAX-powered solution.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Bother Filtering for the Top 10?

Before jumping into the "how," let's quickly cover the "why." Displaying hundreds of bars on a single chart is rarely a good idea. Our brains aren't wired to process that much visual information at once. Limiting your visual to the Top N (where N is usually 5, 10, or 20) offers several immediate benefits:

  • Clarity and Focus: It immediately draws your audience's attention to the most significant contributors. Instead of searching through a sea of bars, they see the MVPs right away. Are you looking at top sales regions, most effective ad campaigns, or most productive employees? Filtering helps you see what's driving results.
  • Improved Readability: Fewer categories mean more space for readable labels, clearer bars, and an overall cleaner look. This makes your dashboard less intimidating and more professional.
  • Faster Decision-Making: When you present only the most impactful data points, a clear story emerges. This allows stakeholders to bypass the noise and move straight to asking strategic questions about why those top performers are succeeding.

Essentially, it's about turning a descriptive chart ("Here's what our sales look like") into a prescriptive one ("Here are our most important products that we should focus on").

Method 1: The Quick and Easy Filters Pane

The most direct way to show your top 10 is by using the built-in filtering options in Power BI's Filters pane. This approach requires no code and can be done in under a minute. It's perfect for static reports where you always want to see the top 10.

Let's imagine we have a dataset with product sales and we want to build a bar chart showing our 10 best-selling products.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step-by-Step Instructions:

1. Create Your Bar Chart: First, build a standard bar chart. From the "Visualizations" pane, select the "Stacked bar chart" or "Clustered bar chart" icon. For our example, let's configure it like this:

  • Y-axis: Drag your category field here (e.g., 'Products'[Product Name]).
  • X-axis: Drag your numerical value field here (e.g., 'Sales'[Total Sales]).

At this point, you'll have a chart showing all your products, which could be dozens or even hundreds of bars long. It’s informative, but not focused.

2. Open the Filters Pane: With your new bar chart selected (you'll see a border around it), look at the "Filters" pane, usually to the right of the Visualizations pane. You'll see sections for "Filters on this visual," "Filters on this page," and "Filters on all pages." Since we only want to affect this one chart, we'll work in the "Filters on this visual" section.

3. Select the Top N Filter Type: In the "Filters on this visual" area, you should see the fields you're using (in our case, 'Product Name' and 'Total Sales'). Click the dropdown arrow for the field you want to filter - the category on your Y-axis, which is 'Product Name'.

Under "Filter type," click the dropdown that says "Basic filtering" and change it to "Top N".

4. Configure the Top N Filter: New options will appear. Here’s how to set them up:

  • Show items: Keep this set to Top. (Note: You can also choose Bottom to find your worst-performing items, a very useful feature in its own right!)
  • Number Field: Type 10 into the box.

5. Define the "By value": This is the most important step. Power BI needs to know how to rank the products. What metric determines the "top" ones? Is it sales volume, profit, quantity sold? You must specify this by dragging the corresponding numeric field into the "By value" box.

Drag your Total Sales measure into the "By value" field.

6. Apply the Filter: Click the "Apply filter" button at the bottom of that filter card. And voila! Your bar chart will instantly refresh to display only the 10 products with the highest 'Total Sales'.

This method is simple and extremely effective for most reporting needs. Its only limitation is that it's static - a user can't decide to see the Top 5 or Top 20 without you editing the report in Power BI Desktop.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Method 2: Give Users Control with a Dynamic Slicer and DAX

What if your VP of Sales wants to see the top 10 products, but the marketing manager wants to see the top 5 campaigns, and the operations lead wants the top 20? Constantly creating new versions of the same report isn't efficient. A more advanced and flexible solution is to create a dynamic chart where the user can pick the "N" value from a slicer.

This method involves writing a little bit of DAX (Data Analysis Expressions), but don't be intimidated. We'll break it down step-by-step.

Step 1: Create a Table for Your Slicer

Our first step is to create a small, separate table that holds the numbers we want users to be able to select (e.g., 5, 10, 15, 20). It's best practice not to use a column from your main data model for this.

In the "Modeling" tab on the ribbon, click "New Table." A formula bar will appear. Enter the following DAX formula:

Top N Selection = GENERATESERIES(5, 30, 5)

Let's break that down:

  • GENERATESERIES is a function that creates a single-column table of numbers.
  • 5 is the starting number.
  • 30 is the ending number.
  • 5 is the increment.

This formula creates a table named "Top N Selection" with a single column called "[Value]" containing the numbers 5, 10, 15, 20, 25, and 30. Feel free to adjust these numbers to fit your needs.

Step 2: Create the Slicer Visual

Now, add a slicer to your report canvas. With the new slicer visual selected, drag the 'Value' field from your new 'Top N Selection' table into the "Field" well of the slicer. You'll now have a slicer on your page that lets users select one of those numbers.

Step 3: Write the Necessary DAX Measures

This is where the magic happens. We need to create two simple measures. The first will capture the user's selection from the slicer, and the second will use that selection to rank and filter our products.

In the "Home" tab on the ribbon, click "New Measure."

Measure 1: Capture the Slicer Value Enter this formula:

Selected N Value = SELECTEDVALUE('Top N Selection'[Value], 10)
  • SELECTEDVALUE checks if a single value has been selected in the 'Top N Selection'[Value] column. If so, it returns that value.
  • The 10 at the end is a default. If nothing is selected on the slicer, this measure will default to showing the Top 10.

Measure 2: Create the Ranking Logic We need a measure that will serve as a flag to tell the bar chart which products to show. Click "New Measure" again and enter this formula:

Is Top Product = 
VAR ProductRank = RANKX(
    ALLSELECTED('Products'[Product Name]),
    [Total Sales],
    ,
    DESC,
    Dense
)
VAR ShowItem =
    IF(ProductRank <= [Selected N Value], 1, 0)
RETURN
    ShowItem

This one looks more complex, but it's pretty logical:

  • First, we declare a variable called ProductRank. It uses the RANKX function to calculate the rank of each product based on "Total Sales."
  • ALLSELECTED tells RANKX to rank only among the products that are currently selected by any other page filters (like a date range or region), which is what you typically want.
  • 'DESC' means we are ranking in descending order (highest sales are #1).
  • Next, a second variable called ShowItem checks if the calculated ProductRank is less than or equal to our [Selected N Value] from the slicer. If it is, it returns a 1, otherwise, it returns a 0.
  • Finally, we return the result of ShowItem. Each top product will get a value of 1, and all others will get a 0.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step 4: Apply the Measure as a Visual Filter

The hard part is over! The final step is to use our new measure to filter the bar chart.

  1. Select the same bar chart you created in the beginning.
  2. Go to the 'Filters' pane.
  3. Drag your new measure, 'Is Top Product', into the "Filters on this visual" section.
  4. Expand the new filter card.
  5. From the dropdown, select "is" and type 1 into the box.
  6. Click "Apply filter."

Your bar chart is now completely interactive! When a user selects a number from the slicer, the [Selected N Value] measure updates, your [Is Top Product] measure recalculates which products receive a "1", and the visual filter instantly shows the correct number of top products.

Common Pitfalls and Best Practices

  • Context is Everything: Remember that "Top 10" is relative to the current filter context. If a user filters the report for "Q3 2023," the chart will correctly show the top 10 products for that specific quarter, not the all-time top 10. This is a feature, not a bug!
  • Handling Ties: In the DAX measure, we used "Dense" for the final parameter in RANKX. This means if two products tie for 2nd place, the next product will be ranked 3rd. The other option is "Skip," which would rank the next one 4th. "Dense" is usually preferred for Top N visuals. Power BI's built-in Top N filter has its own internal logic for handling ties, but it generally behaves as you'd expect.
  • Don't Forget an "Others" category: For more advanced reports, you can go a step further and group all items outside your Top N into an "Others" category. This helps show the proportion of your metric that falls outside the top performers, but it involves more complex DAX. For most cases, simply filtering is sufficient.

Final Thoughts

Filtering your Power BI bar charts to show just the Top 10 transforms an overwhelming visual into a powerful, focused insight machine. Whether you use the simple Filters pane for static reports or the dynamic DAX and slicer method for interactive dashboards, you're helping your audience focus on what truly matters.

Creating these Top N views is a daily task when building reports. Once you get your data connected, the tedious work begins - configuring filters, writing DAX measures, and arranging visuals. At Graphed, we've automated this process away. You simply connect your data sources, and then you can ask, "Show me a bar chart of my top 10 products by sales last quarter," and the AI analyst builds the live, interactive visual for you instantly. Instead of spending time clicking and coding, you can check out Graphed and start getting answers from your data in seconds.

Related Articles