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
Anonymous
Not applicable

pass both filtered and unfiltered data to an R script visualization

I send to you, across the time and space the separate us, a cordial greeting.

 

I will attempt to state my inquiry briefly: I would like to pass both filtered and unfiltered data to an R script visual.

 

Let me attempt to demonstrate my difficulty. Consider the R code below:

R boxplot code.jpg

Observe that the visualization uses both filtered and unfiltered data: The boxplot uses all the data points in the data set, but the red line uses only one data point.

 

The problem is that, in Power BI, when I use a slicer to select the name, I lose access to the unfiltered dataset.

 

I was able to develop a work around by loading the dataset with each call of the R script. See below:

Power BI boxplot code.jpg

I feel this solution is inelegant, as there's the performance hit of loading the data set each time the slicer changes. Besides, users aren't going to be able to deal with this state of affairs.

 

I was reading that Dax has a function ALL(), which I think is analagous to what I need.

 

Any thoughts?

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Your probem is that you cannot feed more than one set of columns/measures (unfortunately called "dataset" - better called a dataframe) into the R visual.  You can decide if your dataset is affected by the filter context or not, but you can't have both.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Your probem is that you cannot feed more than one set of columns/measures (unfortunately called "dataset" - better called a dataframe) into the R visual.  You can decide if your dataset is affected by the filter context or not, but you can't have both.

Anonymous
Not applicable

I think Ibendlin is right.

 

For the sake of experimentation, I tried retrieving the non-filtered data from a SQL database, reasoning that with SQL I can retrieve only the field I want instead of loading the whole dataset. Performance was no better.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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