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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Jingspat
Frequent Visitor

Display Random Subset of Data

I have a table with thousands of rows.  Instead of displaying all the items, I would like to display 10 random rows of data every time to report loads.  Is there an easy way to accomplish this?

 

Regards,

 

JingSpat

1 ACCEPTED SOLUTION

hi @Jingspat

 

You may use RAND() in DAX either as a calculated column but I would prefer a measure as RAND in a measure is not always recalculated (reference). 

 

I tested how RAND works in a measure.  Here's what I did:

  • Add an index column to your table in power query. Apply query changes to load the updated table. This is so we can have one unique value for each row in your table.
  • Create a measure
    ramdom measure = RAND()
  • Add desired fields to a table including the index column.
  • Go to Visualizations pane > Fields > Visual level filters
  • Selected Top N under filter type. Show  Top 10 items. Drag random measure to By Value.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

9 REPLIES 9
danextian
Super User
Super User

hi @Jingspat

 

Which one is your goal?

-select just 10 random rows in power query and then load it to the model

-randomly choose 10 rows of the dataset already loaded to the model





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian Sorry for not being clear.  I am relatively new to all this and am not sure of the proper terminology yet.  I am using a table visualization that returns thousands of rows and then adds a scroll bar on the report, but I just want it to display 10 randomly selected rows of data and no scroll bar.  I believe this correlates to your second scenario "randomly choose 10 rows of the dataset already loaded to the model."

 

Thanks so much!

hi @Jingspat

 

You may use RAND() in DAX either as a calculated column but I would prefer a measure as RAND in a measure is not always recalculated (reference). 

 

I tested how RAND works in a measure.  Here's what I did:

  • Add an index column to your table in power query. Apply query changes to load the updated table. This is so we can have one unique value for each row in your table.
  • Create a measure
    ramdom measure = RAND()
  • Add desired fields to a table including the index column.
  • Go to Visualizations pane > Fields > Visual level filters
  • Selected Top N under filter type. Show  Top 10 items. Drag random measure to By Value.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I can't seem to change the Visual level filter to anything other than "is less than" - it won't let me click the drop down box, but I can enter a value.  What am I doing wrong?

Untitled.png

 

Hi @Jingspat,

 

There is no Top N option for measures.  Please select Index and then choose Top N under filter types then drag random measure to By Value.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Sorry for not getting it! I still can't change the filter type of Index:

 

Untitled.png

 

Here is the modeling tab for the Index column:Untitled.png

 

 

 

 

are you not seeing this option?

topN.png





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I wasn't.  I just updated to the latest version and now it is working!  Thank you so much for the help!!!!

 

Appreciate it!

It didn't come to my mind that you might be using an older version of PBI Desktop but I'm glad to have helped.




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.