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

R custom Visual Filter and Interactions

Hi everyone,

currently, the standard visuals and custom visuals in the store do not meet the requirements of my internal customer. I looked around and found out, that we can build custom visuals via R script, which I happily tried out, as in python and R I can make the visuals, which meet the requirement. I have two issues.

Issue 1:

After finally making the visual work, I wanted to filter the visual with slicers, in which case most work. From my observations, those worked, which were loaded directly from the server. But as soon I use calculated columns, I get the following error:


Error Message:
R script error.
Loading required package: xml2
Loading required package: htmlwidgets
Loading required package: ggplot2
Loading required package: lubridate

Attaching package: 'lubridate'

The following objects are masked from 'package:base':

    date, intersect, setdiff, union

Loading required package: data.table

Attaching package: 'data.table'

The following objects are masked from 'package:lubridate':

    hour, isoweek, mday, minute, month, quarter, second, wday, week,
    yday, year

Loading required package: magrittr
Loading required package: plotly

Attaching package: 'plotly'

The following object is masked from 'package:ggplot2':


The following object is masked from 'package:stats':


The following object is masked from 'package:graphics':


Error: Discrete value supplied to continuous scale
In addition: There were 12 warnings (use warnings() to see them)
Execution halted

The calculated column is simply looking into Measurements and differentiate if it is the last or one of the many previous measurements.

Is Last Measurement =
'[MeasurementInstance] == [MeasurementInstanceTotal],
"Last", "Other"

The weird thing is, that "Other" works and the custom visual is filtered, while "Last" doesn't work and give me the above error.

Issue 2:

While it's nice I can select each point in a scatter plot and "zoom" / filter within the visual, I can't affect other visuals e.g. a histogram or a table with some identifiers or cards with some KPIs.

I already looked into the "edit interactions" and all settings for the other visuals are set to "filter", but it doesn't work when I select something inside the r custom visual (made with Plotly).


Scatter Plot is my R custom visual which should filter also the histogram at the left side



After selecting some values within the  it zooms in, but will not affect the histogram at the left side


Any ideas on how to solve those two.


New Member

did you find a solution for your open point 2? I'm also looking for a solution here.

Community Support
Community Support

Hi @boboroo ,


1.The calculated column is static, while the measure is dynamic, so the measure cannot be referenced correctly in the calculated column.

Please change this calculated column to a measure. If you need to be used as a slicer, you need to create the correct calculated column. Please do not reference the measure in the calculated column.


2.MS only provide APIs to support these operations for TypeScript visuals, and not for R. 

You may try to package R Code into Power BI Custom Visual. 



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

Could you please give an example on how to do what you described in point 2? I have some R Code that i package to a visual exactly following the way described by the link you provided but even with a build custom R Visual and even after changing the configuration files to accept filters (from the IFilter documentary MS support site) it will not filter my other native visuals to whatever i select in R Custom Visuals (i use R plotly as main library). If needed i can share my project.

The R-Based custom visual can't filter/highlight other visuals unfortunately. This can only be done using the standard custom visuals



Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.