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
ak23401
Regular Visitor

Dynamic Top N Ranking with Slicers on other columns

I have a table with the following headers:

[Product    Application   Sales    GrossMargin    SellingPrice]

I want to create a dynamic Top N scatter plot with Sales being the size of the bubble, GrossMargin on x axis; and SellingPrice on y axis.

 

I have a slicer which goes from 1 to 10 (for choosing the value of N in Top N).

I also have a slicer for Product.

Now I have created a Top N scatter chart which shows me top N "Application" on the graph based on the sales value.

 

But now suppose I have chosen N value to be 10, and I unselect a certain product using the slicer, that products bubbles will dissappear from the graph and say I will be left with 8 bubbles on the graph which will belong to the other products. This is not what I want; I want that since the value of N is 10 and only 8 applications are being displayed on the graph, it automatically chooses the next 2 applications with highest sales of the remaining products to be displayed.

How do I make that happen?

I have used the following measures to make my graph right now:

ak23401_0-1721676815068.png

--------------------------------------------------------------------------------------------

 

ak23401_1-1721676851932.png

--------------------------------------------------------------------------------------------

ak23401_2-1721676906914.png

 

 

 

1 REPLY 1
Shravan133
Super User
Super User

try this: 

Modify it according to your measures:

Create a Measure for Top N Filtering

First, you need a measure to dynamically calculate the top N applications based on sales. This measure will be used to filter the scatter plot.

1.1 Create a Measure for Total Sales

Create a measure to calculate total sales:

 

Total Sales = SUM('YourTable'[Sales])

1.2 Create a Measure for Rank

Create a measure to rank the applications based on sales:

 

Application Rank = RANKX( ALLSELECTED('YourTable'[Application]), [Total Sales], , DESC, DENSE )

This measure ranks the applications based on the total sales, considering any slicers or filters applied.

1.3 Create a Measure for Top N

Create a measure to filter the top N applications dynamically:

 

Top N Filter = VAR SelectedN = MAX('TopN Slicer'[Value]) -- Assuming you have a slicer table named 'TopN Slicer' with values from 1 to 10
RETURN IF( [Application Rank] <= SelectedN, 1, 0 )

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 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.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors