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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Adoman
Frequent Visitor

Create tables or queries with R script for further usage

Hi All,

 

is it possible to create tables or queries with Power BI embedded R Script and then use them with Power BI standard Visualizations?

 

Thx

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Adoman,

 

Yes, with just a few steps in Power BI Desktop you can run R scripts and create a data model, from which you can create reports, and share them on the Power BI service. See the following R script as an example.

# Create the data frame.
Emps <- data.frame(
   id = c(1:5), 
   name = c("A", "B", "C", "D", "E"),
   age = c(25, 27, 30, 26, 28), 
   start_date = as.Date(c("2011-01-01", "2012-02-02", "2013-03-03", "2014-04-04", "2015-05-05")),
   stringsAsFactors = FALSE
)

Capture.PNG

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I know this question has been asked and answered already. However, it doesn't really address some of other challenges when working with R in Power BI. For example, how to do create a tabular report directly in Power BI using only the data you loaded -- let's say the data was loaded directly from the database and you clicked on R under the visualizations and you added couple of fields into the R script editor. So, how do you create a table using only those fields?

v-chuncz-msft
Community Support
Community Support

@Adoman,

 

Yes, with just a few steps in Power BI Desktop you can run R scripts and create a data model, from which you can create reports, and share them on the Power BI service. See the following R script as an example.

# Create the data frame.
Emps <- data.frame(
   id = c(1:5), 
   name = c("A", "B", "C", "D", "E"),
   age = c(25, 27, 30, 26, 28), 
   start_date = as.Date(c("2011-01-01", "2012-02-02", "2013-03-03", "2014-04-04", "2015-05-05")),
   stringsAsFactors = FALSE
)

Capture.PNG

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It works, thank you!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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