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
Anonymous
Not applicable

Numeric Range Parameter selected value not recognized in random sampling

Hi, I am trying to have a numeric range parameter (going from 1 to the number of rows in the source table) that can be adjusted to randomly sample a table. I tried to follow the logic of OwenAuger in https://community.powerbi.com/t5/Desktop/DAX-random-sample/m-p/386571 . but run into the issue that the Selectedvalue function only returns the alternate value. 

 

My random sample is a calculated table using the following logic:

 

Random Selection =
VAR SampleSize = SELECTEDVALUE(Parameter[Parameter])
VAR TableWithRand =
    ADDCOLUMNS ( SourceTable, "Rand", RAND () )
RETURN
    TOPN ( SampleSize, TableWithRand, [Rand] )
 
Where Parameter is a numeric range defined as 
Parameter = GENERATESERIES(0, COUNTROWS(SourceTable), 1)
 
The SelectedValue(Parameter[Parameter]) does not work, but if I provide an alternate value (SELECTEDVALUE(Parameter[Parameter], 3) then the sample size is indeed set to 3. 
 
What am I doing wrong that the parameter value selected in a slicer cannot be read to alter the sample size?
1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

A calculated table (or column) cannot respond to a slicer.  If you can find a way of doing what you want with a measure, then it will react.

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

A calculated table (or column) cannot respond to a slicer.  If you can find a way of doing what you want with a measure, then it will react.

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