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

View all the Fabric Data Days sessions on demand. View schedule

Reply
MichaelDove
New Member

Creating Sample Data set via slicer.

Hi All,

 

I have a report page where a user can narrow down data in a table using 7-8 slicers on the page to view data specific to their region/division. Users still require to be able to export to .csv so they are able to investigate with the business the data they identify.

 

What has been requested from the business is to be able to export a random sample of the data in the table where the number of rows in the table may be quite large (thousands of rows). Yes, they could export all to .csv and filter from there, however the business require this "on Demand" sample data.

 

My idea is: create an unrelated table to be used on a slicer, which is used in a Dax table formula and the Sample function to either return a sample or the whole table:

Sample Data Set =
VAR sampleselect =
    SELECTEDVALUE ( 'Sample'[Sample Size] )
RETURN
    SWITCH (
        sampleselect,
        "Sample", SAMPLE (
            20,
            'Table Data Is Coming From',
            'Table Data Is Coming From'[Table Data]
        ),
        "Full Data Set", 'Table Data Is Coming From'
    )

By itself, the sample function creates a table correctly, however when adding to the Switch function, the formula doesn't allow a table to be returned as a result. 

Why doesn't switch() work, and how can I solve this??

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi MichaelDove,

 

Power BI doesn’t support dynamic calculated table (row or column are dynamic) based on slicer because slicer selection is based on visual level but calculated table is based on data model level. You can’t change data in data model level from visual level.

 

If you only want to create dynamic row calculated table, you can use measure as a workaround, however, if you want to create dynamic column calculated table, Power BI doesn’t support this feature.

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi MichaelDove,

 

Power BI doesn’t support dynamic calculated table (row or column are dynamic) based on slicer because slicer selection is based on visual level but calculated table is based on data model level. You can’t change data in data model level from visual level.

 

If you only want to create dynamic row calculated table, you can use measure as a workaround, however, if you want to create dynamic column calculated table, Power BI doesn’t support this feature.

 

Regards,

Jimmy Tao

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
Top Kudoed Authors