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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
alexcaballero
Frequent Visitor

Power BI cannot unload R scripts

The last versions of Power BI Desktop cannot load R scripts. I've tried with different R Scripts that run perfect in RStudio, for example this script:

 

x <- rnorm(100)

y <- rnorm(100)

df1 <- data.frame(x,y)

 

But in Power BI always appears the same two errors:

 

Details: "EvaluateNativeQueryUnpermitted failure: the query 'x <- rnorm(100) y <- rnorm(100) df1 <- data.frame(x,y)' isn't approved for execution."

 

Details: "An error happened while reading data from the provider: 'Object reference not set to an instance of an object.'"

 

What could be the cause of these errors? There is something wrong in the configuration of R in Power BI or there is a bug or error in the Power BI updates?

 

Thank you so much!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@alexcaballero,

I am able to run the above R script in Query Editor of Power BI Desktop July release. 
Capture.PNG1.PNG2.PNG

Could you please check if you configure R location properly in Power BI Desktop?
0.PNG

Regards,
Lydia

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@alexcaballero,

I am able to run the above R script in Query Editor of Power BI Desktop July release. 
Capture.PNG1.PNG2.PNG

Could you please check if you configure R location properly in Power BI Desktop?
0.PNG

Regards,
Lydia

Thank you so much for your answer!

 

Finally, I reinstall Power BI and updated R to the lastest version (I had 3.5 version and now 3.5.1) and the problem was solved. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.