milan’s power bi user r and power bi group
TRANSCRIPT
R and Power BI
Milan’s Power BIUserGroup
Introduction
Adriana Santacroce
Avanade
Analyst, Advanced Analytics
PowerBI Service
(cloud/web)
PowerBI Desktop
PowerBI Report Server
(on-premise)
Connect, transform data, create
advance calculations and build
visual reports.
Power Bi Desktop is a on-
premise application to install on
PC which can be used to load,
transform and visualize data.
Import data and get
started with visual,
sharable web
dashboards.
Power Bi Service is
mainly use to share
dashboards and
reports in the web.
Power BI Report Server
enables users access to
data and insights, and
the enterprise reporting
capabilities of SQL
Server Reporting
Services — in a modern,
on-premises solution.
PUBLISH
Power BI is a business analytics solution that lets
you visualize your data and share insights across
your organization, or embed them in your app
or website. Connect to hundreds of data sources
and bring your data to life with live dashboards
and reports
Power BI – Definition and Tools
• It is a powerful statistical programming language
• Creators: Ross Ihaka and Robert Clifford Gentleman (University of Auckland, New
Zealand)
• Released year: 1997
• Must knows:
• R is an implementation of S programming language
• R design and evolution is handled by the R-core group and R foundation
• Purpose: R focuses on better, user friendly data analysis, statistics and graphical
models
• Community: Thriving open source-community with support coming in the form of:
• Mailing lists
• User-contributed documentation updated by enthusiastic volunteers
• Active Stackoverflow members
• Usability: Statistical models can be written with only a few lines.
• Code repositories: CRAN stands for the Comprehensive R Archive Network: it is a
huge repository of R packages (more than 10,000) to which users can easily
contribute. Packages are collections of R functions, data, and compiled code. They
can be installed in R with one line.George Ross Ihaka Robert Clifford Gentleman
What is R ?
Source: https://www.stat.auckland.ac.nz/2008/ihaka-pickering/full/0029.jpg
https://www.datacamp.com/community/tutorials/r-or-python-for-data-analysis
Important:
• Only data frames are imported
• For the R scripts to work properly in the Power BI query, the R privacy level needs to
be set as public.
• Automatically exporting your script from your R IDE into Power BI Desktop is not
supported.
When PowerBI is lacking…R enters in action!!! R and Power BI integrate each others. It’s
possible to run R scripts directly in Power BI Desktop report as a visual or as a step in an
import query using the resulting datasets into a Power BI Desktop data model.
Integration – Set up R in Power BI
With Power BI Desktop, you can use your external R IDE (Integrated Development
Environment) to create and refine R scripts, then use those scripts in Power BI.
R and Power BI desktop
Integration – Set up R in Power BI
Source: https://docs.microsoft.com/en-us/power-bi/desktop-r-ide
R visuals in Power BI desktop and Power BI Service have a few limitations
PowerBI Desktop* PowerBI Service**
Version of R deployed The one in your pc Revolution R Open 3.2.2.
Packages supported No limitationshttps://docs.microsoft.com/en-us/power-bi/service-r-packages-support
Data size limitation 150,000 rows 150,000 rows
Calculation time limitation Five minutes 60 seconds
Visuals
R visuals respond to highlighting other visuals, but you cannot click on elements in the R visual in order to cross filter other elements.
Same as PowerBI Desktop
R visuals are refreshed upon data updates, filtering, and highlighting. However, the image itself is not interactive and cannot be the source of cross-filtering.
Same as PowerBI Desktop
R Visuals do not display when using Publish to webR visuals are currently not supported in the DirectQuerymode of Analysis Services
RelationshipsAs with other Power BI Desktop visuals, if data fields from different tables with no defined relationship between them are selected, an error occurs.
Same as PowerBI Desktop
Licence Free licenceR visuals require Power BI Pro licence to see R visuals in REPORT and require no licence (free) to see R visuals in DASHBOARD
R visuals not supported in Power BI Report Server (https://docs.microsoft.com/en-us/power-bi/report-server/compare-report-server-service)
* https://docs.microsoft.com/en-us/power-bi/desktop-r-visuals ** https://docs.microsoft.com/en-us/power-bi/service-r-visuals
Known limitations
R and Power BI: DEMO
Fuel economy data from 1999 and 2008 for 38 popular models of car
The dataset contains a subset of the fuel
economy data that the EPA makes available
on http://fueleconomy.gov. It contains only
models which had a new release every year
between 1999 and 2008 - this was used as a
proxy for the popularity of the car.
Source in R: ?ggplot2::mpg
Link: https://community.powerbi.com/t5/R-
Script-Showcase/Using-R-scripts-to-show-5-
different-dimensions-in-a-single-Chart/m-
p/156116
Source: https://pixabay.com/en/car-auto-automobile-vehicle-1245780/
Some useful links
What is R ? R Core Team (2017). R: A language and environment for statistical computing. R Foundation
for Statistical Computing, Vienna, Austria. URL: http://www.R-project.org/
R news and tutorials: https://www.r-bloggers.com/
https://www.r-statistics.com/tag/stackoverflow/
http://blog.revolutionanalytics.com/2017/01/cran-10000.html
Advanced analytics with Power BI and R: http://radacad.com/online-book-analytics-with-power-bi-
and-r
R scripts in Power BI: https://docs.microsoft.com/it-it/power-bi/visuals/service-r-visuals
http://community.powerbi.com/t5/R-Script-Showcase/bd-p/RVisuals
R scripts in a query editor: https://docs.microsoft.com/en-us/power-bi/desktop-r-in-query-editor
Thank you !