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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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