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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
bdelaure
Regular Visitor

Using Slicer for sample size in SAMPLE function

Hi all, 

 

We have a large sales listing out of which we want to take random samples.

We would like to use a slicer which indicates the number of samples to be taken.

 

The slicer is based on a table including a list from 1 to 10.

 

Therefore we thought to use the following formulla:

 

Selection = SAMPLE( SELECTEDVALUE(SampleSize[SampleSize]), SalesFY18, SalesFY18[Invoice amount])

sample selection.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

But this function is not working. 

Could one of you maybe help me out?

 

Many thanks

 

Brecht

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @bdelaure,

 

SAMPLE() function returns a calculated table that lists a sample of N rows from the specified table. A calculated table is static once it has been initilized, won't be dynamically changed based on slicer selection. So, above requirement cannot be achieved now.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Is there maybe any other easy solution?

Currently we are working with static tables and use the input of these tables for our sample size number.

 

Many thanks for your help!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.