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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Run R script feature

Hi there

July Update is kinda cool! In Run R Script feature, what if I want to reference another tables in PowerBi model, how can I do that?

 

Say I have 2 tables

Table1 - during my data wrangling process in Table1 I might want to merge to table2. dataset is table 1 so within this script window what would table2 is known as in this R script window?

 

Hope you can advice.

 

Pedzilla

1 ACCEPTED SOLUTION
ankitpatira
Community Champion
Community Champion

@Anonymous Run R Script feature applies to selected query within query editor. So when you click on Run R Script button it actually creates 'dataset' data frame for the selected query. It doesn't create data frames for all the queries within query editor but only for selected query that you click button.

 

So if you really want to merge queries using R (power bi query editor has merge queries option already), then you should go to New Data Source -> Other -> R Script -> connect to both your data sources, merge and then load in power bi desktop. But unfortunately I think Run R Script button only references selected query and not all the queries. 

View solution in original post

1 REPLY 1
ankitpatira
Community Champion
Community Champion

@Anonymous Run R Script feature applies to selected query within query editor. So when you click on Run R Script button it actually creates 'dataset' data frame for the selected query. It doesn't create data frames for all the queries within query editor but only for selected query that you click button.

 

So if you really want to merge queries using R (power bi query editor has merge queries option already), then you should go to New Data Source -> Other -> R Script -> connect to both your data sources, merge and then load in power bi desktop. But unfortunately I think Run R Script button only references selected query and not all the queries. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.