Power BI Desktop does not install R on our local machine. We have to do that part ourselves. We can find a link to install R here.
For those that aren't aware of RStudio, it's a great (and free!) tool for developing R code, regardless of whether that code goes into Power BI or any other application we you may be using. If you have never used it, you can download it here.
Now that we've ensured Power BI and RStudio are pointing the same location, let's test it out. You can find a link to the Customer Profitability Sample PBIX here.
|Revenue by YearPeriod|
In this PBIX, we can create a new tab and create a line graph of Revenue by YearPeriod. Now, let's try to recreate this chart using an R Visual.
|Enable Script Visuals|
|R Script Editor|
|R Script with Data|
dataset$YearPeriod <- factor( dataset$YearPeriod )
plot( dataset$'Sum of Revenue', type = 'l' )
axis( 1, at = 1:dim(dataset), labels = dataset$YearPeriod )
|Complete R Script|
|Complete R Visual|
Senior Analytics Associate - Data Science