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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.