Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"


0 (0 Likes / 0 Dislikes)
If you're a data scientist you might be familiar with a package called R. This is a really common application that data scientists use to do very deep analytical and statistical analysis over data. It's also a really good visualization platform. What we did with Power BI Desktop was allowed you to integrate with R, to go and say OK, we'll use some of the packages and some of the visualizations that are available in R but host those within the Power BI Desktop report. That means that you can send data that's within your Power BI Desktop file over to R, get R to generate some visuals or run some script against that data and then bring it back into the report and use it on the canvas just like any other visual. Let's take a look at how that works. I've got a Desktop report here with some data already loaded. In this case, we're looking at different models of cars and then some stats around kind of the number of carburetors, the number of cylinders, the engine size, et cetera, et cetera. Let's just add a table just so you can see the sort of data I'm talking about. It's just some simple numeric data, and what we're going to do here is actually look at the correlation between all of these different metrics for each car. Maybe there are some correlations between things like the miles per gallon or the horsepower compared to the number of cylinders, for example. So to create an R visual, all I need to do is choose that from the visualizations pane. It will get added to the canvas just like anything else and you'll see at the bottom of the window there's an R script editor that gets generated. Now, because of the way that we've zoomed in, in this video, it takes over a whole lot of the screen. If you're using a larger screen resolution, you wouldn't see this or at least it wouldn't take up so much space. But you can see, to get started we need to start adding some fields into the value area of the field well. So let's just pick the fields that we're interested in. I'm going to add all of these ones down here, and you can see them being added to the field well here on the right-hand side. You can see in the script that we're actually starting to build some of the R script up. And these are just some commented outlines. This is some work that we do behind the scenes to create a data set which is the unit of data that R operates over. And we're doing it by passing in all of the different fields that we selected from our model. And then down at the bottom I can start pasting or typing in my R script. I've got some that I've already typed up before. You can see what we're doing is we're using a correlation plot library that I downloaded and installed from the web. We're converting our data set into a matrix. That's what the correlation plot library uses, and you can see here this is the line that actually generates our correlation plot. So it uses the matrix. And then there are some parameters that just change the way that that visual looks. So now when I hit run what's going to happen is we're going to take that data and from the Power BI Desktop send it my local installation of R, run the script, get a visual back and put that onto the Power BI canvas. It happened pretty quickly. It's taken that data, sent it over to R, and then brought the visual back in. And you can see we've got some correlations shown in this visual so there's obviously really high correlation between the individual fields, but you can see the blue ones are a high correlation, the red ones are lower. I can come back and edit that script further. So I've got a few examples here. I've just commented out some different lines that just render the correlation plot in a slightly different way, just changing some of the parameters for that. So hit run, it re-renders, and now we get weird circles instead of squares, and the size of the circle is indicating the correlation to. Because this is just visual on the Power BI Desktop canvas, it works like any other visual. So I can resize it, I can move it around, but it's also interactive like any other visual. So we'll create a little donut chart and let's just add whether or not this car was a sports car and just do a count of the number of sports cars. So we can see that we've got a few more sports cars than we have -- Sorry -- few fewer sports cars than we have non-sports cars. Now when I start selecting and interacting with these visuals, the other visual will get updated as well. So if I want to focus and look just at the sports cars, when I click on that, you'll see the R visual gets updated and it gets filtered down to show just the data for those cars. Compare that to the non-sports cars, you can see it's re-rendering as I interact with that data. So in the same way that we would've filtered or re-highlighted any other visual when I interact with it, the R visual as the data filtered down it gets sent back to R, the visualization gets rendered again, it gets sent back to the Power BI Desktop. And I've taken that same Desktop file and published it up to the Power BI Service. You can see I get exactly the same R visual rendered here and it remains interactive as well. Effectively what we've got is a version of running in R Services while that allows you to keep re-querying this data, and as data refreshes in the Service, it will be updated and all these visuals can react to that as well. So it's a really simple way that you can use R to enhance your Power BI reports using the huge library of visualizations that are available, using all the scripts that you might find on the internet to go and manipulate your data, visualize it in different ways, and then share that with other folks around your organization just as you would do any other Power BI report.

Video Details

Duration: 5 minutes and 47 seconds
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 24
Posted by: csintl on Jan 7, 2017

----- (Please provide translations for these languages: English (eng).)

Caption and Translate

    Sign In/Register for Dotsub to translate this video.