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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
andre_kauber
Frequent Visitor

create new table using R

Hello,

can I actually use an R script to create a new table with summarized metrics of an existing table, or do I need to create a calculated table with DAX? I assumed that R could be used to create new tables, but when I tried, I realized that any operation run on an existing table essentially replaces it, correct?

1 ACCEPTED SOLUTION

Right. Copy this query in Query Editor (right-click, copy and then paste) Rename this new query to something else, "Summarized". Then, in the original query, remove your R script step. Presto, 2 tables.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

I would use DAX and probably use SUMMARIZE. In theory, you could copy your query for your table, add an R script step and end up with a summarized table. Is there a reason you need R to summarize a table?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you for your reply. I need R because I know it, but I don't know DAX yet 🙂

So, you're saying that it is possible to use R to generate a new table? As explained, when I run the R script on an existing Power BI table, the result overwrites my table instead of creating a new one..

Well, if you know R, DAX is an utter cake walk. So, when you say "run the R script on an existing Power BI table", how, specifically, are you doing that?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I loaded the table from an excel file in Power BI, then edit query, transform, run R script. I pasted my working code from R and run it. The result overwrote the existing table.

Right. Copy this query in Query Editor (right-click, copy and then paste) Rename this new query to something else, "Summarized". Then, in the original query, remove your R script step. Presto, 2 tables.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello

 

Sorry, I do not get your answer. I have three datasets (uploaded from excel) and want to do data management using R, in particular using rbind function in order to create a unique dataset where I will do my dashboard.

I have followed exactly this post : https://stackoverflow.com/questions/44897796/operations-on-multiple-tables-datasets-with-edit-querie...

and my rbind works except that my dataset rbind overwrites my first dataset and i would like to have another one.

When you said "rename this new query" is it my first data frame? 

 

Thanks,

Mélissa

 

 

Hi - I have looked through all the posts but not been able to find the query solution. If it is not too much trouble can you please re-post it?

Thank you.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors