An introduction to using R in Power BI via the various touch points such as: R script data sources, R transformations, custom R visuals, and the community gallery of R visualizations
2. Eric Bragas, Jr.
DesignMind BI Consultant
Trainer for Power BI, Master Data Management, other BI
topics
◦ SQL Saturday
◦ Power BI Dashboard In A Day
◦ In-depth MDM
Passionate about learning, design, and data
3. Agenda
What is R in Power BI?
When to use R in Power BI?
How to use R in Power BI?
◦ Setup
◦ Data Source
◦ Script Visual
◦ Transformation
R-powered Custom Visuals
Other
◦ External IDEs
◦ Supported Packages in PBI Service
4. What is R?
“R is a language and environment for statistical computing and graphics”
Capabilities include
◦ Statistical Analysis
◦ Modeling and
◦ Data Visualization
Wiki: https://en.wikipedia.org/wiki/R_(programming_language)
5. What is Power BI?
Microsoft’s Self-Service BI application
Capabilities include
◦ Connecting to a variety of data sources
◦ Data transformation through PowerQuery
◦ Data modeling
◦ Data Analysis via DAX
Power BI: https://powerbi.microsoft.com/en-us/
6. What is R in
Power BI
An intersection of two tools
Power BI provides multiple touch points for R
◦ Allows R scripts as data sources
◦ Data transformations as part of Power Query steps
◦ R visualizations
◦ R-powered custom visualizations
Unlimited R script options when working locally
Limited support for reports published to Power BI Service
Does not include/require Microsoft R Server
7. When to use R in Power BI
No dedicated modeling capability (read: small R
implementations)
Robust visualizations; beyond what Power BI can provide
◦ Augment Power BI, don’t try to replace it
Data manipulation beyond DAX capabilities
Integrating R modeling capabilities into PowerQuery
9. Setup
Install R - https://cran.r-project.org/
(optional) Install R IDE
◦ R Studio
◦ R Tools for Visual Studio (RTVS)
Install R Packages
Power BI settings
◦ Options > R Scripting
10. R Script Data Source
Reference all dependent packages
Only data frames are imported (not vectors)
◦ All data frames available in navigator
NA is translated to NULL
30 minute time out
What other use cases do you have?
12. R Script Visualization
Augment Power BI visualizations using R
◦ base
◦ ggplot2
◦ ggmap
◦ etc.
Rendered to default R device
◦ Interactive and animated visuals not supported
14. R Script Transformation
Allow you to manipulate data via Query Editor steps
Can be used to
◦ clean data
◦ generate additional values ie. model results
◦ run any R script ie. write.csv()
Executes as part of the query, so only when the data set is refreshed
16. Other Resources
External IDEs
◦ R Studio
◦ R Tools for Visual Studio
Supported Packages in the Power BI Service
◦ List of supported packages
◦ Request additional packages
Additional Resources
◦ Download R from CRAN (Comprehensive R Archive Network) or MRAN (Microsoft R Application Network)
◦ Power BI visuals in R
◦ Additional visualizations