Power BI – Use Top N Filters
The top N filters, property enables users to see the top results of numeric data, the numeric data can be a sum, average, count, min, etc. One can view and display the other properties of the dataset, by setting a top filter bar to numeric data. The top N filters property is similar to SQL TOP N function. In this article, we will learn how to use Top N filters, with an example.
Adding Top N Filter
There are many use cases for the Top N filter, for example, we are given data on students’ marks, and we want to know the top 3 performers in the class, or total sales for each product is given, and we want to know the product with maximum sales.
Consider a dataset, of dance pop_playlist, and we want to know the Top 5 companies which own the maximum followers, in the era of pop_playlists. The task can easily be achieved by the Top N filter.
The following are the steps:
Step 1: Create a table, for owner_name, and total_followers. In the below image, you can see the Filters option.
Step 2: Now, in the Filters tab, under Filters on this visual. Click on the owner_name (All). A drop-down will appear. Under the Filter_type, click on the Basic filtering list. A drop-down appears again.
Step 3: The drop-down has an option Top N. Click on it.
Step 4: Under Show items, select the Top N values you want to list. For example, 5.
Step 5: Here, comes one of the most crucial steps. Under the By value, you need to select, on the basis of which column, you want the Top 5 values. For example, the Top 5 values are displayed for the Sum of total_followers. The sum can be changed to average, count, min, etc. Click on the Apply filter button.
Step 6: You can view the list of companies’ names, which have the Top 5 total_followers.