Showing results for 
Search instead for 
Did you mean: 
kqian Frequent Visitor
Frequent 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?

Moderator v-sihou-msft

Re: Passing a parameter to an R visual



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.



Anthony_W Frequent Visitor
Frequent Visitor

Re: Passing a parameter to an R visual

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!



Helpful resources

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 57 members 1,374 guests
Please welcome our newest community members: