4: Developing reports and visualizations using the Power BI Desktop
4.9 Create slicers
4: Developing reports and visualizations using the Power BI Desktop
4.9 Create slicers - Video Tutorials & Practice Problems
Video duration:
6m
Play a video:
<v Lecturer>Okay, so in this sub lesson,</v> we're gonna define slicers. We'll create two slicers. We're gonna learn how to format slicers, and then we're gonna introduce the concept of syncing slicers across pages. Okay, so let's go ahead and get our desktop file open for sub lesson nine and wait a moment while it opens up. Okay, so our desktop files open here now. So let's go ahead and create our two drop-down slicers. So we're gonna create one for country and one for our dates. Okay, so let's go ahead and create the country one first. So what I'm gonna do here is just open the fields up a little bit here. Let's actually just zoom in on our visualizations here and show you where the slicers are. So right on the, near the bottom of the visualizations pallet here. I can click on slicer and just zoom ourselves back out, and we can see that I've got a blank slicer showing up here. I'm just gonna actually move this roughly to this location right here. Cause this is where we're gonna be putting it. We'll fit it inside these white boxes at the very top. Okay, so the very first thing we're gonna do is actually go ahead and bind our data into it. So we said, we're gonna make this country. So I'm gonna do is open up the sales territory table, grab country and drop it into field here. And then we're gonna see we're gonna get the country here and all the countries that are in the dimension table. Okay, the first thing we're gonna do here is we're going to change this to a drop down box. So if I hover over the top of the visual of having focus, I can see there's a little tiny arrow next to this eraser here and I click that and move that from a list to a dropdown. So the box is gonna look something like this now. Okay, so now at this point I'm actually gonna take this and get it to fit a little bit closer to, actually lets just go like that. Not gonna quite make it fit there yet. Let's just go ahead and leave it like so so we can do some further formatting. Okay, so what we're gonna do here first is let's actually just show you the drop down. So when we click the drop down, we can see that we've got all the different countries in here and what I wanna do here first is change the way this works. So I can go in here and click individual countries. We'll see that we can go ahead and make multiple selections. Well let's go in and actually change some of the configurations of this dropdown. So once again, I've got it highlighted, I'm gonna go over to the format under the visualizations pane. And the first thing we're gonna do is we're gonna go into selection controls. So I'm just gonna make this little bit bigger here. Click the dropdown box on selection controls and let's go through and take a look at things. So right now single select is off. So if you notice when I went through the opening example there I was able to click on multiple boxes by clicking the control key. I can also go down here and say do I want to allow that multi-select with a control key, which was what we had there? And also want to turn this show, select all options. So I'm just gonna turn that on. If I go back to my drop down box, we're gonna see now that we have the select all option here, so all right. That's the way we want our, oops. That's the way we want our format to work. So I'm just gonna go back over here into the selection controls again and everything looks perfect as we see it right now. So what I'm gonna do is I'm going to go back into the formatting here and I'm going to close that card up there, and I'm gonna go to my slicer header. And I'm gonna turn that one off. So if I turn that off, you'll notice the header goes away there. Okay, so then the next thing I'm going to do here is actually turn the background card off as well. All right. So now it's gonna be transparent. And the next thing I'm gonna do is I'm gonna go to my title card and turn it on. I'm gonna go like that. Go into here. And I'm actually going to call this country. So I'm going to just go country, like so. Spell it right here. All right. There we go. Perfect. Okay, so now we've actually got things set the way we want. Okay, so let's just go ahead and get this formatted to fit inside of here. So let's go like this and I'm just gonna go like this. So I've got country just sitting outside of the white area there. So let's just make this a touch bigger, like so. Oops. All right There we go. So now we have it the way we want. We have country outside of here. I've got the drop down box, and now we can go ahead and choose countries. So just a little tip here that I want to show you is we're gonna create a second slicer. But I don't want to go through any of that formatting work because essentially I want the two slicers to be exactly the same. Just to have different values coming out of them. So what I'm gonna do here is I'm gonna go control C. I could actually right click and say, copy visual exo as well. And then just go into a blank here the canvas and go control V on the keyboard. Now what I'm gonna do is actually just drag this one over here like that. And what I'm gonna do here now is create the year drop down box. So I'm gonna do here is go like this, go to my order date table. Over here, find my order date year. I'm gonna drop it in on top of country here. That's gonna create an error, but that's okay. And then what I'll do here now is get rid of country out of here. Okay, so now I've got the exact same formatted dropdown box that I had before. The only thing now is this is going to display countries. The last thing that we want to do here is we are going to go in and remove or change our title. So let's go back to our format and go down here and let's just call this year, like so. Perfect. So now we have our two drop-down boxes through slicer. So we have country and year. And we can go through and let's just pick, actually let's start with year here. So I can go over here and choose 2020, for example. And we'll notice now all these visualizations respond to that change. In a couple of sub lessons from now we're gonna talk about how to edit the interactions. So we don't get these situations like this one down below showing up in the line chart where we now just end up with a dot. So we're gonna look to isolate some of these visuals away from changes in other visualizations. So that's something we'll take care of once we get into the section on editing the interactions. Okay, so the last topic that we want to introduce here, and we're not actually gonna give an example of it, is if I go to my view tab right here. I can actually go on the far right hand side here and there's this show panes group. I can click the sync slicers command and this will allow us to go ahead and sync slicers across multiple pages. Now we don't have slicers on multiple pages here but if you're used to using sync slicers in Excel, this is effectively behaving the exact same way. But we just want to expose the fact that this actually exists for you to go ahead and do if you have slicers across multiple pages that you wanted to go ahead and keep in sync. All right, so that brings us to the end of this sub lesson.