Okay, now let's start to work with getting our data from this three data sources. Okay, so have your Power BI Desktop open. And what we will do next is let's go to get data. And we want to go and get the data from a website. So let's select web. Okay, so now it's asking for a URL.
So first things first is let's start with our first data source. So we'll be working with the team stats, the traditional team stats, so I'll just be copying the complete URL from here. So I'll just right click Copy, right. And the let's go over here and let's paste it over. Once you have the URL, just go Okay, and it will start to parse or analyze the website on which sets of data you could retrieve from it. Okay, so it will take quite a while but hopefully not that long.
And once you have that ready, we'll explore what data it has in store for us. And what we're after. Definitely is the table right? The table that we're seeing with the teams the point, Okay, then let's see if it's able to get it successfully. Now, you could see here that it got three sets of data here. So let's just select document and see what's in here.
Nope, this is not the one. Let's go to table zero. Yep. If you look here, it looks good, right? This is the games played, wins last, the team names, right? And then if you just scroll over here, and you have all the other statistics, let's go to web view.
Okay. And you could see here, right, it has the same web page that we showed a while ago. And it has highlighted the table correctly over here. Right? So which means this is the part that it retrieved the data from for table zero. So once we're happy with this, okay, this is what we'll be selecting table zero.
Okay, so that looks good. Just out of curiosity, let's have a quick look at table one just to see what it looks like. And this is not the one we're after, right? So we're happy with it. with zero, make sure that's selected. And let's go to Edit.
So once we have that, it's going to be loading it straight to the power query editor window. And now we can work on our transformations. So this prop over here is just showing, so I'll just close this, okay? Because I've already loaded this before when I was working on this exercise, right? And for you, it shouldn't be showing up if it's your first time loading this data. Okay, so I just closed that one, we can just ignore that.
Okay, and the first transformation that we want to do is we want to remove this column over here. This is data that we don't need. So I'll just right click on the column header, and select Remove. So okay, that's remove right now. And then what we're going to be doing next is we want to get the location of the teams over here. Okay, because if you look closely, the formatting over here for the team is dedication, followed by the name Okay, so you have Houston as the location.
And then your team name is rockets. Okay? Same thing as well, Golden State as the location warriors is the team name over here. So the pattern just repeats for every single team over here. So what we're going to be doing is we will be transforming this column, right? And splitting it by the space, okay, so that we can get the occasion and then the team name afterwards.
But the question right now is what do we do with the occasions that have to write two words over here, so for example, Golden State, so what we're going to be doing is we're going to be splitting it by the rightmost space, okay? So which means this space over here, we're going to be splitting it to another column, right? Same thing as well for that, say, Oklahoma City, right, we're going to be splitting the tunder out right with the rightmost space. So what we'll do right now is transform and go to the split column by delimiter. And if we look here, right, we want to split by space and make sure it's the rightmost delimiter. Once you're good with this, select OK. And just like that, you've already split the column into two.
And you have the team names over here. And you have the locations over here. Okay, so if we scroll down, it's looking good at the moment, except for one thing, right? One of the records don't look like a location, which is this one port on Trail Blazers, because the team name is actually trailblazers, and the location is Portland. This is the only team that has a team name of two words. Okay?
If you look at the others, they're all looking good, except for this one. Okay. So the question now is, what should we do? Okay. So, this is one thing that's very nice with Power Query, because even though if something doesn't look right, if you did the initial step, you made some assumptions and this look right, right. You could move back a step right?
You could move to another step actually, and what we're going to be doing. So let's move a step back up over here before we did the splitting. So this is the step where we remove the numerical column, right? And I'll be doing any additional change over here. So what I'll be doing is for the Portland Trailblazers, just to make the formatting is consistent with the rest of the team names. I'll be changing the trail space blazers into just a single word of trail blazers, okay, without a space.
So what we'll be doing right now is I'll stick with transform, and then I'll go to replace values. Okay, so he's just saying, Do you want to insert a step midway, okay, because we're, we're editing it right? In this step over here, and that's perfectly fine. Okay, so I'll just go insert, and what I want to find is the value of trail blazers and change it to get out of the space. Okay, we're happy Have a desk, okay? And if you look now, it's now trailblazers is one word.
And here's the cool thing. You don't need to split it again. Because what power query will do now is since we have the split step defined, if you click here, you could see that it applied the same transformation. Okay? And it was able now to split it successfully because trailblazers now doesn't have a space in between. So the right will space, okay, it was able to split it correctly.
And now, it works great for everything. So the cool thing with Parkway is it was able to apply it right, we made the change midway but it was able to apply the steps even afterwards. So there was no need for us to redo it. Okay. So now we're happy with this. Okay, the splitting looks great.
Now we need to do some renaming on the columns just to make it better. So I'll just double click on the column name and type location in here. Let's go to Team two and change it to team. Okay, and then Just to make it look better, that's changed this GP two games. Okay, so we're done with this. And before I forget, let's rename as well, this name over here two teams.
That's because table zero is not really that descriptive. So you could see once I change this table zero over here in the queries rights section, also change to Team stats. So it's looking good for a first data source. And now we'll be working on the next one, which is team defense. Oh, and before I forget, I mentioned a while ago that we only want to keep until points. And we want to remove all of the columns until the very end.
So what we're going to be doing is, this is the column that we don't need. Make sure that selected, right, let's scroll over to the right, hold Shift, and click the last column, right. And then we can remove all of them. So let's just go to home, select remove columns, and there you go. We have a much Smaller and cleaner table. Okay, so we're good with Team stats, let's jump over to the next data source, which is team defense.
So let's go over to this page. So this is team defense with our defensive rating over here. So what I'll do is, let me just copy this URL. Let's go back to our Parkway. And okay, you can actually add a new source as well in this window. So just go to new source, same thing, select web.
And then let's paste in our URL here for the defensive stat or defensive rating, and wait for the retrieval to complete. So it's going to be the same steps actually. So now we have our document. Okay. So let's just check if it has the defense rating. Okay, that's looking good.
So we're good with this document is this data over here? Let's just tick it. Let's go okay. And let's see if it's able to load it correctly. Okay, now, let's look Good, we have the number we have the location. So just make sure whenever you load something from a web page, just double check the sources, right, and just make sure that it has the correct data.
Because sometimes it behaves differently, you might be seeing a different list. But in that list, one of the tables are one of the items in there would have your data so you would just be following the same steps and just select it and then load it in here. Okay, so now once we have it in here, what will we be doing is let's make the same transformation. So let me just right click here, remove, can actually go to Home remove columns as well. So let's do that. Once you have that removed, we'll be doing the same steps right for the getting the location in here.
So we'll be replacing first let's go to transform let's change the trailblazers okay to have a no space in between. Okay, so let's replace values, Trail Blazers, okay. And then put it Without a space, okay, so that the format will be consistent across all of the team names. Now let's go to split column delimiter. And now we'll be splitting it by the right space. Go okay.
And there we have it. Okay, let's double click, rename location. Same thing here, double click, rename it to team. And what we're after is just this the defensive rating. So we don't need all this data, just select this column over here. Let's move all the way to the right, hold Shift, right click here and go remove columns.
Now, we have it cleaned up. It's looking good for this one, and let's rename it to team defense. Okay, now we have two queries ready? Team stats, team defense. Now let's jump over to the third one. Let's go to Team clutch and see what's gonna happen next.
Now let's jump over to Team club. Over here, and let's just copy the URL copy. And let's jump over here. And you should know the drill by now let's go to new source and select web. And we'll be pasting in our last and third data source. Let's go okay.
And once you have it loaded, let's have a look now and see if the clutch stats are being displayed over here. And Yep, for document. Looking good. We have the number of clutch games played over here. Okay, so this is what we're after we have all of the team names as well, that select this and go okay. Okay, now, it's just removed the notification.
We now have our data lifted here. Okay, so it's looking good. Now we'll be doing the same transformation. Let's just remove this column, right click Remove. That's changed Trailblazer again, it's going to transform or place value. Okay.
Then Trail Blazers, Trail Blazers without a space, go, okay. And we'll be splitting this column. So you should know the drill by now, right more space, go okay. And let's rename this to occasion, rename this to team. And then we can also rename the games played over here to touch games. Okay.
And then what we can do is let's just keep all of the data until the win percentage. So I'll just go here, select this column, hold Shift, select until the very end, and right click, remove columns. Now we're good with the data. just rename this to Team clutch. And we're good to go. So now we're pretty happy with all of the data that we have, right?
And what we're going to be doing next is we're going to be loading this data sources into our data model.