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
kqian
Regular Visitor

Passing a parameter to an R visual

What is the best way to pass a parameter into an R visual? One solution that works but seems very inefficient is to take every possible value of the parameter and create a copy of your dataset for every value, with the parameter's value in an extra column. Then you can create a slicer on that column. Therefore if you have 10 possible values for your parameter, your resulting dataset passed into R is 10 times the original size. If you have three parameters with 20 options each, your resulting dataset is 8000 times the original size. If your parameter is continuous, this is obviously impossible.

 

A better solution might exist if there was the ability to pass in multiple datasets into an R visual, but as far as my searches go, this is not possible.

 

Is there a better way to pass in a parameter without need to mash it into the dataset that is being passed into R?

3 REPLIES 3
Anonymous
Not applicable

Hi All,

 

Is this issue resolved and can we use Dynamic slicer\Parameters in R or Python visual? 

Anthony_W
Helper I
Helper I

I was looking into this recently too. I would also like the capability to pass multiple slicers/parameters into the R visualisation without the need to include all of the slicer values within the data (and consequently having to magnify the data size to accomodate all of the different slicer values). I don't believe there is any easy fix to this at the moment.

 

I came up with a partial solution by inputting the data from with the R code itself (via the read.csv command). The data that is passed to the R visualisation are the slicer values. This means you need to create a table with all of the different slicer variations in Power BI. This approach reduces the overhead of incorporating all of the different slicer variations into the data. As I said, it is a partial solution.

 

Hope this helps!

 

cheers,

v-sihou-msft
Microsoft Employee
Microsoft Employee

@kqian

 

No, it's not possible. You can't apply parameter like Query Parameter in R script executed in R visual. It doesn't support executing R script within R visual dynamically based on selection in slicer.

 

Regards,

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