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! Request now

Reply
rvpmvp20
Frequent Visitor

Dynamic Selection with Selected Value for Random Rows

Hi,

 

im trying to get back random lines from an exisiting table. I added a slicer with the country ids, after picking i want to have random rows where country id matches. if i hard code the FilterValue in the TOPN line, i get what i want. also if i hard code the VAR Filter Value, it works. So it has to do with SelectedValue? Relationshop exists, same data format.

 

Random Selection =
    VAR SampleSize = 2
    VAR FilterValue = SELECTEDVALUE(Dummy[Country_id])
    RETURN
        TOPN(SampleSize, FILTER(Dummy, Dummy[Country_id] = FilterValue), RAND())
 
please help 🙂
4 REPLIES 4
Ahmedx
Super User
Super User

not exactly. in my dummy data i have lines for different countries. now i want to pick a country with a slicer and then get SampleSize lines for that country only. However, with selected value (see formula above) i dont get any results.

if you want to create random rows (table) then it will not interact with the slicer

is there a different way to interact?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors