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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
P2J
Frequent Visitor

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.