You are currently viewing How to Get Top 10 in Power BI?

How to Get Top 10 in Power BI?

One of the key features of Power BI is the ability to filter and sort data to identify trends and patterns. One common requirement in data analysis is to find the top or bottom results based on a specific metric.

Filter Top 10 in Power BI
Filter Top 10 in Power BI

In this post, we will explore different ways to get the top 10 in Power BI. Whether you are a beginner or an advanced user of Power BI, these techniques will help you gain valuable insights from your data.


Different ways to get the top 10 in Power BI

When working with large datasets in Power BI, it’s often useful to focus on the top results to gain insights into the data. Fortunately, Power BI provides various methods to get the top 10 results based on specific measures, including using the “Top N” filter, the “RankX” function, and the “Visual-Level Filters” option.

Each of these methods has its own benefits and use cases, and choosing the right one can depend on the specific needs of your analysis.

In this post, we will explore each of the below methods in detail to get Top 10 in Power BI and provide examples to help you understand how to implement them effectively in your Power BI reports.

  1. Top N Filter.
  2. Top N in DAX.
  3. Ranking in DAX.
  4. KEEP TOP Filter in Power Query.

Download the PBIX file (4 Ways to get Top 10 in Power BI)

1) How to use Top N Filter to get Top 10 in Power BI?

Suppose you have a products report that shows the amount for each product category.

How to Filter Top 10 in Power BI

To get the top 10 products based on product amount, you can follow these steps:

Steps

  1. Click on the sales amount table visual to select it.
  2. Go to the Visualizations pane and expand the Filters section.
Filter Pane in Power BI
  1. Click on the arrow besides the field that you need to filter, in our case, it’s “Products“.
  2. At “Filter type“, select “Top N” filter option.
Top N in Power BI
Top N in Power BI
  1. Select “Top” or “Bottom“, and Enter 10 as the value for the Top N filter.
  2. From “Data” pane, drag the “Amount” column at the “By value” section.
  3. Finally Click on “Apply filter“.
Top 10 in Power BI
Top 10 in Power BI
  1. Great, the top 10 results is now shown successfully.
Display Top 10 in Power BI

This is one of the easiest and most commonly used ways to get the top 10 values in Power BI using Top N filter.


2) How to use Top N in DAX to get Top 10 in Power BI?

Besides the TOPN filter option, you can also use TOPN function in DAX to get Top 10 in Power BI by doing the following:

Steps

  1. Click on “Data” section, then click on a table to create a new table based on DAX function in Power BI.
Create a DAX table in Power BI
  1. Write the below formula to filter only the top 10 rows based on the “[Amount]” field in the “Products” table order by descending.
Top 10 Products = TOPN(10, Products,Products[Amount],1)

You can set the 10 value to any number as you need, and the last option is used to order by (1 for Descending, and 0 for Ascending).

Read also, Top N Vs RANKX in Power BI DAX
  1. Great, the result has been filtered successfully to show only the top 10 rows as shown below.
Get Top 10 in Power BI ordered by DESC

3) How to use RANX function in DAX to get Top 10 in Power BI?

One way to obtain the Top 10 rows in Power BI is by utilizing the “RANKX” DAX function. This function assigns a rank to each product according to the sales amount, and the steps to implement this method are outlined below:

Steps

  1. In your table, create a new calculated column.
Create a calculated column using RANKX in Power BI
  1. Write the below formula based on your table and column
Amount Rank = RANKX(ALL('Products'),'Products'[Amount])
RANKX in Power BI

You might also like to read RANKX Syntax and Top N Vs RANKX in Power BI DAX

  1. Click on your visual, then In “Filter” Pane, add the newly created column as a filter field.
  2. Select “Advanced Filter” and set it as shown below.
  3. Finally, click on “Apply filter“, you will note that the result has been filtered to only show the TOP 10.
RANKX to get top 10 in Power BI

4) How to use Power Query to Get Top 10 in Power BI?

One way to obtain the Top 10 rows in Power BI is by using Power Query as outlined below:

Steps

  1. Load your data into Power Query editor by selecting “Transform data” from the Home tab.
Power Query in Power BI
  1. In the Power Query editor, select the column you want to sort by.
  2. From the “Transform” tab, select “Sort Ascending” or “Sort Descending” depending on how you want to sort the data.
Sort by in Power Query in Power BI
  1. From the “Transform” tab, select “Keep Rows” and then select “Keep Top Rows“.
Keep rows in Power Query in Power BI
  1. In the dialog box, enter the number 10 to indicate that you want to keep the top 10 rows.
  2. Click OK to apply the changes.
Keep top rows in Power Query in Power BI
  1. Once you have completed these steps, you should see only the top 10 rows of data in your Power Query editor.
Top 10 in Power Query in Power BI

Download

You can download the PBIX file with 4 Ways to get Top 10 in Power BI, and don’t forget to follow Power BI Repo to get more PIBX files samples with complex DAX formulas.

Conclusion

In conclusion, getting the top 10 results in Power BI is a common task for data analysis and reporting. There are multiple ways to achieve this, including using the Top N filter, Top N function in DAX, or RANKX function in DAX. Each method has its own advantages and can be applied in different scenarios based on specific needs.

By understanding these methods, users can easily obtain the top 10 results in their Power BI reports and make data-driven decisions.

See Also

Mohamed El-Qassas

I'm Microsoft MVP, SharePoint StackExchange Moderator, Microsoft QnA Moderator, C# Corner MVP, Microsoft TechNet Wiki Judge, and Senior Technical Consultant with +12 years of experience in SharePoint, Project Server and Power Platform.