Power BI and Creating Custom R Visualizations: Pre Getting Started / First Step Install List
I was recently on VM (virtual mentoring) duty at Pragmatic Works (PW) and was asked to fix someone's custom R visualization in Power BI (PBI) Desktop. Consequently, it was "Hello, R scripting!" for me, and of course, I wanted to apply all that I've learned in t-SQL, VB, C#, MDX and DAX. First suggestion: Don't do that.
Here is the skinny: Before you try to create custom R visualizations in PBI, do these things:
1. Download and install Microsoft R Open from https://mran.revolutionanalytics.com/download/
Download and install R for Windows from https://cloud.r-project.org/
2. Download and install Microsoft R Client from https://msdn.microsoft.com/en-us/microsoft-r/r-client-install
3. Download and install R Studio from https://www.rstudio.com/
4. (Optional) Download and install R Tools for Visual Studio (preferred by some over R Studio for R development)
5. Make sure you have the latest PBI Desktop version installed. (Look in the lower right corner of the PBI Desktop software and if there is no informative message of an available update, you are all set.)
6. Verify that PBI Desktop is set to use installed R components. In PBI Desktop, go to File --> Options and Settings --> Options --> R Scripting. The R home directory and Detected R IDE properties should be filled in appropriately.
You will find many tutorials already on line, so I'll just share what I learned about what I call "pre-getting started":
1. You must have #1, #2 and #6 complete (above) for some of the R-powered visuals from the PBI Custom Visuals Gallery to even install without error in Power BI Desktop.
2. When you are told in tutorials that "of course you have the package installed" or "you may have to install the package first", what this means is that you must open R Studio and install the R package before the R script in Power BI Desktop will run. This is the first four lines in the screen print below.
With the necessary R applications installed on your workstation, and the R packages you intend to load in PBI installed in your R environment, you are now ready to begin.
3. I suggest strongly that you get your R visualization working correctly in R Studio (my preference) or R Tools for Visual Studio because PBI Desktop does not provide meaningful error messages.
4. Final tip: PBI R-powered visualizations aren't EXACTLY identical to what you will see in R Studio, especially if your 'x' or 'y' axis is a date or time data type. You may need to work with text data types to get around this.
Note: Virtual mentoring at Pragmatic Works is a great way to get pay-as-you go consulting help from an industry leader in the MS BI tool stack (just saying!).
|Microsoft Data & AI||