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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DJBAJG
Helper III
Helper III

Top N filter not working with random number measure

Probably a real easy one. I'm trying to filter a visual to show the top 3 values of a column based on a random number measure RAND(). The picture shows the exact setup. Clearly it's not limiting the visual to the top 3 random numbers. Ultimatel, the visual won't have the random number column on it but I put it there for illustrative purposes. Thoughts? 

 

DJBAJG_0-1680025558302.png

 

3 REPLIES 3
amitchandak
Super User
Super User

@DJBAJG , USe top N measure

 

example

2 column top N = CALCULATE([Net], TOPN(10, SUMMARIZE(ALLSELECTED('Item'), 'Item'[Brand], 'Item'[Category]), [Net],DESC),VALUES('Item'[Brand]), VALUES('Item'[Category]) )


2 column top N = Sumx(Keepfilters( TOPN(10, SUMMARIZE(ALLSELECTED('Item'), 'Item'[Product Category], 'Item'[Product Name]), [Total_sales],DESC)), [Total_sales])

 

Use your columns

 

Check

Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I'm going to need more clarification. I understand the TOPN function but I'm not sure how your examples get me where I need to be with my specific issue.

 

I must use the random number as the driver of the TOPN. Every time I make a slicer selection I need rows displayed to change. That's the whole point. It needs to be random. I don't have the ability to build out measures for each value I need to dispaly in the table. 

So apparently this isn't possible? 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.