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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to use the data in Dashboard with R

Hello,

 

I am a new R user and I know how to import the data from an excel file in R but how do we use a data set present in a Power BI project with R?

 

Thank you to the community for their help.

 

1 ACCEPTED SOLUTION

Hey @Anonymous ,

 

this can become lengthy 🙂

 

If you just want to derive an R script visual from var1 .. var15, just drag the variables to the R script visual band. The variables form the data.frame called dataset.

 

If you want to execute the "Run R script" task inside Power Query, things get worse.

First you have to be aware that each step (more or less each) from the "Applied Steps" pane on the right side inside Power Query represents a table. Then you have to be aware that "Run R script" task as just one input (a table) and one output - a table.

You have to think about what has to happen with the the remaining 5 columns var16 .. var20.

 

Maybe you end up with the following

two table references

a) just var16 ... var20 (simply deleting the first 15 columns)

b) a table with just the 15 columns, now you execute "Run R script", paste your R script, make sure that finally a data.frame object is return.

 

Merge both tables using Power Query functionality.

 

But as I mentioned, this can becom quite complex.

 

Regards,

Tom

a reference to a



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey @Anonymous ,

 

how to use R in Power BI is a broad question for this start reading this, if you want to use your R knowledge to shape data:

https://docs.microsoft.com/en-us/power-bi/desktop-r-in-query-editor

 

If you want to use R to visualize your data, start reading this:

https://docs.microsoft.com/en-us/power-bi/desktop-r-visuals

 

Please be aware that there a limitations regarding the supported packages from Power BI service:

https://docs.microsoft.com/en-us/power-bi/service-r-packages-support

 

Currently only the on-premises gateway installed in personal-mode allows to use R scripts.

 

Hopefully this gets you started.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hello

 

Thank you very much for all this information.  It will be very useful.

 

Let's refine my question.  Imagine that in a Power Bi project, I have a table A with 20 fields from var1 to var20.  Then if I would like to use var1 and var15 in R, How I am going to do that?

 

Dataset<-????????

Hey @Anonymous ,

 

this can become lengthy 🙂

 

If you just want to derive an R script visual from var1 .. var15, just drag the variables to the R script visual band. The variables form the data.frame called dataset.

 

If you want to execute the "Run R script" task inside Power Query, things get worse.

First you have to be aware that each step (more or less each) from the "Applied Steps" pane on the right side inside Power Query represents a table. Then you have to be aware that "Run R script" task as just one input (a table) and one output - a table.

You have to think about what has to happen with the the remaining 5 columns var16 .. var20.

 

Maybe you end up with the following

two table references

a) just var16 ... var20 (simply deleting the first 15 columns)

b) a table with just the 15 columns, now you execute "Run R script", paste your R script, make sure that finally a data.frame object is return.

 

Merge both tables using Power Query functionality.

 

But as I mentioned, this can becom quite complex.

 

Regards,

Tom

a reference to a



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.