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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Pull 10% of Random Rows and Display in a Table

Hi - 

 

So, simply put - i have a SharePoint List with 50 rows of data.

This is connected as a Data Set into my PowerBI dashboard.

What i want to do is have another table that simply retrieves 10% of the available rows, at random.

 

So, 50 records = Displays 5 rows, randomised.

 

Refreshing the data then causes the 5 rows to change again and again. Not worried about repetition or repeats, as long as the probability of repeat is as low as reasonably practical.

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

Here's one way to do it in the query editor.  Just update with your site URL and list Id (or make a query to your list and then add the last two rows, updating the step references in the advanced editor).

let
    Source = SharePoint.Tables("https://xyz.sharepoint.com/sites/Sandbox", [Implementation="2.0", ViewMode="All"]),
    ListData = Source{[Id="e552e9e0-3614-432d-a4bb-944e54f642c0"]}[Items],
    ListItemCount = Table.RowCount(ListData),
    #"Filtered Rows" = Table.SelectRows(ListData, each List.Contains(List.Transform(List.Random(Number.Round(ListItemCount*0.1, 0)), each Number.Round(ListItemCount*_, 0)), [ID]))
in
    #"Filtered Rows"

 

Pat

Microsoft Employee
Anonymous
Not applicable

Ok, i've open query editor within the pbix that i have already made and in the left hand side, clicked "new query" and in the editor bar at the top, copied/pasted your code and swapped out the URL and ListID correctly, hit the Tick button and its all red, hitting apply doesn't generate a table of data within query editor- what am i doing wrong? 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors