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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ysf
Helper I
Helper I

How to dynamically fetch sample data, using whatif parameter value or parameter value

Hi 

 

I have created a sample table using the Dax sample

Sample data = SAMPLE(30, FILTER('Table 1', 'Table 1'[Field] = "Values"),0) 

This works fine.

 

After that I have created a WhatIf Parameter so that i could use it to pull the data to a certain record count.

What if Parameter : 

Sample Pull = GENERATESERIES(0, 200, 1)
-> 
Measure :
Sample Pull Value = SELECTEDVALUE('Sample Pull'[Sample Pull],30)

 

I have then used the parameter value to generate the sample data.

Sample data = SAMPLE('Sample Pull'[Sample Pull Value], FILTER('Table 1', 'Table 1'[Field] = "Value"),0)

Have also tried the below .

 

In this example it seems to only pickup the default value from the what if parameter which is in my case 30 as written in the code above.

Sample Agric DDA =
VAR
PULL = 'Sample Pull'[Sample Pull Value]
RETURN
SAMPLE(PULL, FILTER('Table 1', 'Table 1'[Field] = "Value"),0)
 
In these examples it returns nothing
Sample Agric DDA =
VAR
PULL = VALUE(SELECTEDVALUE('Sample Pull'[Sample Pull]))
RETURN
SAMPLE(PULL, FILTER('Table 1', 'Table 1'[Field] = "Value"),0)
 
Sample Agric DDA = Sample( VALUE(SELECTEDVALUE('Sample Pull'[Sample Pull])), FILTER('Table 1', 'Table 1'[Field] = "Value"),0)
 
All I need is to dynamically allow end users to extract however many records they'd like to sample for their puroposes.
 
7 REPLIES 7
Icey
Community Support
Community Support

Hi @ysf ,

 

Can the method provided by @Mariusz meet your requirements?

 

 

 

Best Regards,

Icey

Mariusz
Community Champion
Community Champion

Hi @ysf 

 

SAMPLE returns a table and both columns and tables are loaded when on data load/refresh, therefore, you will not be able to make an impact on it with a measure as the data has loaded already.

 

You can create a Power Query parameter and combine it with SAMPLE  DAX function I guess.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi @Mariusz 

 

I have created a a parameter via PowerQuery but gives the same results when using its selected value.

the main intention is to allow for end users to decrease or increase the number of records to sample.

Mariusz
Community Champion
Community Champion

Hi @ysf 

 

Please see the attached file with an example of how to combine Power Query Parameters with DAX SAMPLE function

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Thanks @Mariusz this helps in that I can change the paramenter value on the service myself, but it still needs more work if the report consumers want to change the parameter value so as increase the rows returned. I am guessing its not available right now.

 

 

Mariusz
Community Champion
Community Champion

Hi @ysf 

 

Yes, unfortunately, the only way I know of change the parameters in the service is by going to settings of the dataset.

You can create an Idea for this here if no one has yet as it seems like a good one.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Mariusz
Community Champion
Community Champion

Hi @ysf 

 

Please see the attached file with a solution that combines what-if parameters and Table visual filtered by Measure. Hope this is close enough to what you need.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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