Search code examples
rpowerbipowerbi-desktop

Is it possible to use R scripts as a data source for PowerBI when published to the PowerBI Service?


I have a PowerBI file that uses R scripts as a data source. The scripts access a database, query and manipulate a few existing tables, and then imports the resulting table into PowerBI. The scripts run well on PowerBI Desktop but unfortunately when attempting to publish this to the PowerBI service, I am running into a gateway issue. I am using an On-premise data gateway that can successfully connect to the SqlServer, but spits back an error related to R: Extension{"extensionDataSourceKind":"R","extensionDataSourcePath":"R"}

R Extension error

Scouring the PowerBI support forums and resources, everything that I have found only talks about generating visuals using R, and I have yet to find a resource talking about using R scripts as a datasource for PowerBI. I found this stackoverflow thread from 2019, but have yet to find anything more recent.

Is it possible to use R scripts as a data source when publishing a file to the PowerBI service?


Solution

  • Using an R or Python data source in Power Query only supports the Personal Mode gateway.

    After you've uploaded the .pbix file to the Power BI service, you need to take other steps to enable service data refresh and updated visuals:

    Enable scheduled refresh for the semantic model: To enable scheduled refresh for the workbook containing your semantic model with R scripts, see Configuring scheduled refresh. This article also includes information about on-premises data gateways.

    Install a gateway: You need an on-premises data gateway (personal mode) installed on the machine where the file and R are located. The Power BI service accesses that workbook and re-renders any updated visuals. For more information, see use personal gateways in Power BI.

    Use R in Power Query Editor