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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ranjan
New Member

Automate R script from PowerBI

Hi,

I have recently started using Power BI for visualization. Am working on a project where I have to do some processing on data in SQL server and then load that data to PowerBI for the dashboarding. Now, it will work like a tool which will be refreshed at certain frequency.
I am trying to replace the processing part of the process from SQL server to R, since its much faster and versatile in processing.

Data(in SQL server) => Stored Procs in SQL Server => PowerBI ----- current scenario
Data(in SQL server) => R script => PowerBI ----- expected scenario

For now I am doing that using Getdata option in Power BI and run the R script manually everytime I need to refresh it. R connects to SQL server, loads it in memory, does the processing and a table is generated which I can use for dashboarding in PBI.

Is there a way where I can write some kind of function or query which can pick the R script when I open the dashboard, run it and refresh the dashoard. Basically, automate the process. I am stuck for quite some time now.

Appreciate any help.

Regards,
Ranjan

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

unfortunately it's currently not possible to automate some data processsing using R scripts. This is due to the deprecation of the standalone Personal Gateway and the fact the new gateway currently does not support the execution of R scripts for data processing.

 

This thread may provide some additional information

https://community.powerbi.com/t5/Integrations-with-Files-and/R-Integration-with-Power-BI-Scheduled-R...

 

If you are in the lucky position to be able to use SQL Server 2016 or SQL Server 2017 you can use the integration of R or even Python (SQL Server 2017) from within a stored procedure, maybe this link gets you started:

https://docs.microsoft.com/en-us/sql/advanced-analytics/tutorials/sql-server-r-tutorials

 

Hopefully this of some help

 

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

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

unfortunately it's currently not possible to automate some data processsing using R scripts. This is due to the deprecation of the standalone Personal Gateway and the fact the new gateway currently does not support the execution of R scripts for data processing.

 

This thread may provide some additional information

https://community.powerbi.com/t5/Integrations-with-Files-and/R-Integration-with-Power-BI-Scheduled-R...

 

If you are in the lucky position to be able to use SQL Server 2016 or SQL Server 2017 you can use the integration of R or even Python (SQL Server 2017) from within a stored procedure, maybe this link gets you started:

https://docs.microsoft.com/en-us/sql/advanced-analytics/tutorials/sql-server-r-tutorials

 

Hopefully this of some help

 

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

Thanks Tom,

 

I hope it works out soon enough. And yeah, as suggested, I have started working on getting SQL Server 2016/17 so that I can run R script from there itself.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.