This is why I created a duplicate from the base query. Note: As you see we’re modifying the query. Select a “Detected R home directory” from the dropdown list then click OK.You can change it from Power BI desktop Options as below: Note: As you see in the “Run R Script” window, there is a description after the script block showing your current R home directory.
Now open SSMS and query the “Exported_From_PowerBI” table too see the exported data. If everything is fine then you’ll see an empty table in Query Editor without any error messages. So your script should look like the below figure. The first backslash is considered as an escape character. Note: If you have more than one SQL Server instance then you need to add an extra “\” (backslash) in the server name.
You can download my Power BI Desktop model at the end of this post.) Open an existing Power BI Desktop model that you’re willing to export its data to a SQL Server table and follow the steps below: (I use “Internet Sales” model created on top of AdventureWorksDW.
Then all you really need to do is to copy the “RODBC” to the “library” folder exists in either R or SQL Server 2016 folders in your “Program Files” folder.
You have to download the library from the link provided above, then extract the contents of the zip file which contains a “RODBC” folder.
Installing RODBC Library for R and SQL Server R ServicesĪs mentioned earlier, you can install R OR SQL Server R Services OR R-Server, but, as I haven’t tried R-Server myself I just explain how to install RODBC in R and SQL Server R Services. Note: I haven’t installed R Studio and nothing went wrong. Install RODBC library for R, you can download the library from here.Either install R for Windows, you can download it from here OR using an existing R-Server OR install SQL Server 2016 R Services.Have access to an instance of SQL Server, either on your own machine or on a server in your local network to export the data to.Latest version of Power BI Desktop, you can download it from here.So I don’t explain exactly what he did, but, I use his method to export data from existing Power BI Desktop model to SQL Server and I explain it step-by-step. Exporting Data from Power BI Desktop to SQL Server with RĪs stated before, Hans has already explained this method here. If there is any other methods you’re aware of please let me know in the comment section below. I also explain how to export data from Power BI Desktop to SQL Server using SSIS. With respect to Hans, in this post, I explain his method of exporting data from Power BI Desktop to SQL Server more in details so that anyone who is not that familiar with R can make it work. So if you are familiar with SSIS, then it might be your your preferred choice.
You can export Power BI data to SQL Server using SSIS (SQL Server Integration Services). Luckily, there is another way to export your Power BI data to SQL Server which is more BI friendly. That’s so true about myself, I’m NOT an R guy, but, who knows, maybe I will be.īut, what if you don’t want to go with R? If you are more involved with BI than analytics, then using R might not really be your cup of tea. Although Hans has done a brilliant job, it might be a bit hard to make it work if you don’t have any R experience and you don’t even know how to install and call R libraries. Hans Peter Pfister has already explained how to export data from Power BI Desktop to SQL Server using R scripts. As promised in this post I explain how to export data from Power BI Desktop to SQL Server. In the previous blog posts I explained how to export Power BI data to Excel and CSV here and here. If you want to export the data model from either Power BI Desktop or Power BI Service to CSV or SQL Server check this out. You can now export the data directly from Power BI Desktop using my tool, Power BI Exporter.