Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Dynamic R GGPlot Visuals Based on Slicer

Hi everyone,


I haven't been able to find much about R in Power BI related to my task. Basically, I'd like to use a slicer to dynamically change an R visual. For example, a slicer to change the x-axis (e.g. if we're talking sales, I'd like to change the x-axis between Product Category, Country, and Buyer using a slicer). If that is possible, then I'd also be able to do the same to color/fill the graphs depending on a slicer as well.


So far I've tried to use Field Parameters as an input, but it gives me the object not found error even though I've added the Field Parameter to the visualization and called it out in the R code.


Is this possible to do with R in Power BI?


Thanks in advance!

Community Support
Community Support

Hi, @TheQ 


Based on my research, for your requirement, I'm afraid it couldn't achieve in Power BI for now.


As a workaround, Please have a look at these posts to check if it could help you.

Dynamically switching axis on visuals with Power BI - Kasper On BI

Solved: Dynamic change in X Axis - Microsoft Power BI Community

Dynamic color for slicer - Microsoft Power BI Community


You can submit an idea for it at and wait for users with the same needs as you to vote for you to help make it happen as soon as possible.


Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


Helpful resources

collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.