Welcome to Excel magic trick number 1,332. Hey, wait a second. This is an Excel magic trick, but I'm going to show you PowerBI Desktop. Now, here's our goal in this video, and it's the same goal we had last video. We have a bunch of Excel files with proper data sets, and we need to import all of them and stack them up one on top of each other. So we have a single table and then we need to create this visualization in PowerBI desktop.
Now I'm going to go look at the final result. Here's what we're trying to do. Boomerang Incorporated 2016 to 2017 sales. Here are some cities and here are some sales rep. If I click on Portland Chin, instantly all the other visualizations are filtered. If I come up and click on quad, instantly all the visualizations update and are filtered. If I come over to the map and click just on Oakland, instantly everything is filtered.
Now, that's our end result. But we're using PowerBI Desktop. Now, why in the world would I call this an Excel magic trick? The reason why is we're going to use all the skills we learned in our last video, 1331, and use them in PowerBI desktop. Now, I'm no expert with PowerBI desktop. I'm just going to take my Excel skills and see if I can use them over there to make this amazing visualization.
Now, two things. You are going to have to go to the link below the video and download this folder that contains all of these files. Now, you have to download it as a zipped folder and unzip it to get to these files. And we'll look at these files in just a moment. You're also going to have to download PowerBI Desktop. Now, you just go to Google, search for it. It's a free download from Microsoft. I'm going to close this.
Now, why in the world would we download PowerBI desktop when we already have Excel with Power Query and Power Pivot and visualization tools? Well, this is a free tool. You do not need Excel and it automatically in one tool combines Power Query, Power Pivot, Power View, and a bunch of visualizations. And for us Excel users, we can apply many of our Power Query and Power Pivot skills over here. So it'll look good on our resume if we've used it a few times and say, "Yeah, I've used PowerBI desktop."
Now, in this example, we will only use the Power Query and the visualization part of it. We won't make any DAX formulas. We'll come back to this and look at this in just a second. But guess what? All of our Power Query skills that we learned last video for importing and transforming multiple Excel files will be the same over here in PowerBI Desktop.
Now, let's go look at our files. Just like last video, we have a bunch of files. And I put some extra files like an access file and a CSV and text that we'll have to filter out. But when I open one of the city files, each one of the city files will have date, product, units, and sales. And on each sheet tab, there will be sales rep. So, we're going to have to consolidate these four columns. We're going to have to add an extra column with sales rep. And we're going to have to add an extra column that will incorporate the city name. No problem for Power Query or PowerBI Desktop.
All right. So now I'm over here in PowerBI Desktop. Before I do anything, I'm going to save as. And guess what? The keyboard F12 works over here just like in Excel. I'm going to call this I called it 1332 Boomerang Incorporated 2016 to 17 dashboard. And you can save it where you want.
All right. Now, Power Query, we got to go up to and look at this. Get external data. There's just get data. That's going to be Power Query. I don't see from folder. So, I'm going to go down to more. Get data. And there it is. I'm going to click on folder. Doubleclick. Looks kind of like Power Query over in Excel. Click browse. Point to the folder. We're telling PowerBI Desktop Powerquery to get all the files in that folder. I click okay. Click okay. I'm going to click edit. I'm going to click apply changes. I don't know why it popped over here. I'm going to rightclick edit query. And there's what should have popped up. I'm not quite sure why that did.
But guess what? This is very similar to Power Query, only a few different elements in our query editor window. Now, the first thing we need to do is filter out to show only XLSX and XLSM. Notice that there's some capitalized one and since case matters in PowerBI desktop and Power Query, I'm going to rightclick transform lowercase.
Now, I want to filter to only include XLSX and XLSM. Come up to the filter text filters equals and I'm going to do this different than our last video. Now in our last video where we said begins with xls but in this query here I want to exclude any xls or xlsb because those files aren't quite as easy to deal with as our x's and m's. So I'm going to say equals xlsx and then or you can also equal xlsm. That way I'll only get those two. Click okay.
Now we need to get the city name. So I'm going to split it after the dot. Select the column. Split column by delimiter. A delimiter is just something that separates data. It's not a comma. I'm going to come down to custom. It's going to be a period. We're going to say split at rightmost delimiter just in case someone had a period near the front. Click okay.
Now, we don't need any other columns. So, I select name, hold shift, click content. Right click, remove other columns. We need to get at the data in this column. We cannot expand that. That little double downward pointing arrow is for text data. And we don't have text data. We actually have Excel workbooks that contain objects. So we're going to add an extra column to extract the Excel objects.
Add custom column. I'm going to call this column get Excel objects. Notice this window looks exactly the same as over in Power Query. We're going to use the same function Excel.Workbook workbook open parentheses. Now, case matters and spelling correct matters. I need to get at the content in this column right here. So, I'm going to doubleclick. Now, that content contains a bunch of different objects, but when we get to the sheets that we want with the headers, date, sales, and so on, I need to promote those headers. So, the second argument in Excel.Workbook workbook is do you want to promote headers and it's true all lowercase. So the first argument is the Excel objects or the content. The second one is promote headers. Close parentheses. Click okay.
And there's our extra column. Rightclick content. We don't need that. Remove. Now I'm going to expand the column. And these are a bunch of different aspects for those Excel objects. I actually do not need hidden. I only need kind. So I'm going to uncheck hidden. Kind will give us the type of object, whether it's a sheet or table or defined name. I don't need item. I need data and I need name. That'll be my sheet name. Click okay.
Now the first thing we want to do is the objects. There's sheets table define names. We only want sheets. So, I click the filter text filters equals and I want to only equal capital S h. Click okay. Everything's filtered out except for sheet. Over in our sheets, looks like they're all named properly. We want to filter out any sheets that begin with sheet. So, I come to the drop-down text filters does not begin with and I'm going to type sheet. This will filter out any, you know, sheets that weren't named properly. Click okay.
Now, I don't need kind. Rightclick, remove. Now, I can expand to finally get to the actual transactional records. I click the expand button. I want all of them, but I do not want to use the original column names up here. I want just these names. So, I click okay.
Now, I'm going to come over here and doubleclick and call this city. Enter. Remember that data came from the file name. I want to also check in the transform ribbon tab. The actual data type text is fine. Double click. I'm going to call this sales rep and enter. I'm going to check the data type and change it to text. Date, I want to change the data type to date. Product data type to text. Units data type to whole number. Sales, change the data type to decimal number.
Now, I want to come over and name this query. Notice there's all the steps. Just like over in Power Query, I'm going to name this all city tables and enter. Now, I'm going to go over to the home and close and apply.
Now, here's our blank white canvas that we get to build our visualizations over here. Here's our visualization. There's our table and there's any relationships. We don't have any relationships. We have a single table here. Go back to visualizations.
Now, I actually just hit pause because I wanted to update my PowerBI desktop, which I hadn't updated in the last month. And guess what? You will actually have to go back out to the site and reddownload it every time. There's not an update button like there is inside of Excel to update the latest Power Query. But I want to show you something. I'm going to go over here's the table we just imported. I'm going to rightclick, edit query. And when we open it back up, look at this. It has these icons which came out recently for data types. So now this is looking even more like Power Query we did in our last video.
All right, this is all working fine. I'm going to close this. Now we want to make some visualizations here. We have three visualizations. Here's our visualizations. This will be the area like the pivot table field list where we drag fields and drop them. Here's our table and there's our field list.
I'm going to start by selecting the visualization. I'm going to click on the map. We instantly see a little preview there. I'm going to check city and then check sales. And just like that, I'm going to pull this down for sales. We can see the various cities. There's Seattle, Tacoma, Portland, San Francisco, actually San Francisco, and Oakland.
All right. Now, I'm going to click in the white somewhere and do my next visualization. They're going to be two bar charts. I'm going to click on the bar chart, drag it down to the bottom, over to the side. Now I'm going to drag city down to the axis and instantly we see nothing. I'm going to drag sales down to the values and there we go. Now I need sales rep in the legend and instantly at the top we see our legend.
Now I'm going to click in the white somewhere and do a second bar chart. Click on the bar. Drag it over. Drag it down. Product is going to be in the axis. Sales is going to be in the values. Maybe try and drag it down a little bit. Make the map a little bit smaller.
I'm going to add a title at the top. Text box. Here's my text box. I'm going to click. All right. something like Boomerang Incorporated 201617 sales. Controll A to highlight everything. I'm going to make it something like 32. Drag this so it's on one line. Pull it up near the top. Format. I want to align center. Click off in the white somewhere.
That already is looking amazing. And here is what is so amazing. If I click on Aspen, everything else is filtered. If I come back and click a second time, it's unfiltered. If I come down to Oakland, Fran, there it is. All of the filtering. I click again and it's unfiltered. There's all of Portland, Seattle, the Oakland sales, and there were filtered on Oakland. And if I come back and click Oakland, back to unfiltered.
Now, here are five cities. Remember, this is PowerBI Desktop, and it's pointing to a folder. So, let's go drag a new file into that folder. I'm going to come back over to Windows Explorer. One of the files you can download is San Jose. I'm going to copy it. Double click to open that folder. CtrlV. There it is. a new file with axlsx. So when we go back to PowerBI desktop, we go to home refresh. And there it is. It's refreshing. And just like that, we have San Jose. And there it is right there. If I click on San Jose, everything is filtered. If I uncheck it, there we go.
So that was pretty amazing. PowerBI desktop. Well, it was kind of just like using Power Query and a pivot table field list to create this great visualization. All right, we'll see you next trick.
