Monday, May 21, 2018

POWER BI and R

We are all aware of the revolutionary reporting tool of Microsoft Power BI. It has lots of inbuilt capabilities and could be further enhanced with the help of another powerful analytics language R

I tried to find out some information on this and some basic tutorials but no luck. Everything was very difficult to understand for people who are new to Power BI or R. So i thought of share my my understanding in a simplistic way. Below is how R could be used in Power BI.

Installation of R
Power Bi service know how to use R Powered visuals but when you create the Power Bi desktop requires a local R installation on your machine. R installation information is available on this URL
After installation, enable the R in the power BI desktop. the steps for the same are available to the URL mentioned above.

Using R in Power BI
R can be used in Power BI in 2 different ways.

  • Using R Script as a Data source: We could use R to load data into Power Bi like any other data source.
    To use R as data source, Click "Get Data" from menu and select R Script. It will open a dialog box where we could paste our R script. Paste your R script and click Load.
    If you are not familiar with R, you could use below sample data set. This just static  data set for learning purpose 
fruits <- data.frame(name = c("Apple", "Banana", "Grapes", "Grapes"), Id=c(1,2,3,4))
    fruit_sales <- data.frame(Id=c(1,2,3,4,3,2,1), qty= c(10,12,13,34,43,12,10))
    This code would create 2 data sets for Fruits and Fruit Sales. The power Bi is intelligent enough to create a relationship between the 2 data sets.
    • Using R Script to create a visualization
      To create a visualization using R, Select the R visual from the visualization pane. This will open an R script editor where we could add our code. Select the fields on which we need to visualize. I have selected Id and qty from the Toy_Sales.
      You would notice some comments(starting with #) in the editor which would suggest id and qty fields are loaded in the variable named dataset. Now we will use the plot function of R to plot a graph between ID and quantity sold. Write plot(dataset) in the editor.
      You would see a graph. This is just very basic and could be enhanced to any level as R has one of the most powerful visualizations.





    3 comments:

    1. I think Power BI is the best application which easily provides solutions for many complex IT problems.It easily creates and helps in developing dashboards.

      Powerbi Read Rest

      ReplyDelete

    If you liked the post, please share it.
    Subscribe to your email and receive new articles on your email