In this series I will be looking at R-Script in the context of Power BI and showing some examples of where I have used R-Script to provide bespoke solutions for my clients.

These posts will only touch the surface of what R can do but my aim is to only introduce people to the concept and hopefully provide enough information for you to at least get started.

Disclaimer: I am by no means an R-Script expert or have the expertise of a fully fledged data scientist so if you are looking for an in depth look into R I would look elsewhere.

What is it?

When you see powerful analytics, statistics, and visualizations used by data scientists and business leaders, chances are that the R language is behind them. Open-source R is the statistical programming language that data experts the world over use for everything from mapping broad social and marketing trends online to developing financial and climate models that help drive our economies and communities.

Uses in Power BI

R can be used with Power BI in a number of ways.  

  • Custom Visual Development

Here are some cool examples of custom Power BI visuals created using R:

  • As a data source
  • As a data transformation tool

I will hopefully provide examples of all 3 throughout this series.

Key Limitations of R Script Visuals

There are some key limitations to having R Visuals in your reports which you should consider before deciding to use them:

  • R visuals require a Power BI Pro license to render in reports, refresh, filter and cross-filter
  • Plotting is limited to 150,000 rows. If more than 150,000 rows are selected, only the top 150,000 rows are used and a message is displayed on the image.
  • If an R visual calculation exceeds 60 seconds the script times out, resulting in an error.
  • R visuals respond to highlighting other visuals, but you cannot click on elements in the R visual in order to cross filter other elements.
  • R visuals are currently not supported for the Time data type. Please use Date/Time instead.
  • R Visuals do not display when using Publish to web.
  • R visuals currently do not print with dashboard and reports printing
  • R visuals are currently not supported in the DirectQuery mode of Analysis Services

For more information, see here

Getting Started [credit]

Download R

Power BI Desktop does not include, deploy, or install the R engine. To run R scripts in Power BI Desktop, you must separately install R on your local computer. You can download and install R for free from many locations, including the Revolution Open download page, and the CRAN Repository. The current release of R scripting in Power BI Desktop supports Unicode characters as well as spaces (empty characters) in the installation path.

Enable R visuals

To enable R visuals, select File > Options and settings > Options and in the Options page that appears, make sure your local R installation is specified in the R Scripting section of the Options window, as shown in the following image. In the following image, the path local installation of R is C:\Program Files\R\R-3.2.0 and that path is explicitly provided in the text box. Make sure the path it displays properly reflects the local R installation you want Power BI Desktop to use.

That’s all you really need to get set up.  In the next post I will go through an example that should hopefully put things into context.

Next up:  Power BI & R-Script Part 2 – Creating an Inverted Y-Axis Chart