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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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