Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
charlottesmn
Frequent Visitor

Dynamic Top N based on column ordering

Hello!
I have a table with customers and a couple of different metrics (number of orders, number of items bought, number of connections, total spent...). By default, the table is ordered by the number of orders. I would like to limit the table to show only the top 50 customers. However, I want the top 50 to update if the user decides to order the table by a different column. I know I can use the TOP N feature but I was not able to make this feature update based on the column chosen for the table ordering?

Thank you!

1 ACCEPTED SOLUTION

To make the TOP N filter dynamic based on the column selected by the user, you can create a dynamic slicer using a What-If Parameter:

 

1. Create a slicer table that contains all the headers of the columns you want to filter into one column.
2. Create a measure that uses the RANKX function to rank the values based on the selected column.
3. Use the slicer to filter the values based on the selected column.


The TOP N filter will update dynamically based on the column chosen for ordering by the user.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @charlottesmn ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Sergii24
Super User
Super User

Hi @charlottesmn, take a look at this video which shows how exactly you can achieve the desired result! Even if it's not fully dynamic as you still need to hardcode selection values in DAX, it can be very useful in your further research.

Good luck!

AlphaBravo
New Member

To use the TOP N feature in Power BI, build your visual as usual. Then, click on the visual and open the filters pane. Add or select the filter you want to apply the TOP N filter to, in this case, the ‘Customers’ filter. Select TOP N, choose whether to show top or bottom items, and enter the number of items to show, which in this case is 50.

 

The crucial part is the ‘By value’ section. This is what determines what the top or bottom 50 are based on. Drop the related column in this section and click apply. Power BI will automatically pick a calculation for you, such as sum or count, but you can change this.

 

For example, you can choose it to be a SUM of Value delivered or a COUNT of instances delivered, depending on your data.

 

Note that the TOP N filter won't update dynamically if the user decides to order the table by a different column. It will always be based on the column you selected when setting up the filter. 

Thank you for the quick response. Is there any way to make the TOP N update based on the column the user selects? 

To make the TOP N filter dynamic based on the column selected by the user, you can create a dynamic slicer using a What-If Parameter:

 

1. Create a slicer table that contains all the headers of the columns you want to filter into one column.
2. Create a measure that uses the RANKX function to rank the values based on the selected column.
3. Use the slicer to filter the values based on the selected column.


The TOP N filter will update dynamically based on the column chosen for ordering by the user.

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.