Power BI Slicer is commonly used to add filters to the canvas, or to display filters on the report canvas. In this article we will show you, How to Create a Slicer in Power BI with example.
For this demonstration we are going to use the SQL Data Source that we created in our previous article. So, Please refer Connect Power BI to SQL Server article to understand the Data Source.
How to Create a Power BI Slicer
In order to create a Slicer in Power BI, first Drag and Drop the Fields that you want to use as filter to Canvas region. In this example, we want to use Country as the Filter for this report. So, let me drag the Country from the Geography table to the Canvas. This will automatically create a Map for you.
Click on the Slicer under the Visualization section. This will automatically convert a Map into Slicer. From the below screenshot, you can see the list of countries.
Create a Power Bi Slicer – Approach 2
First, click on the Slicer under the Visualization section. This will automatically create a Slicer with dummy data.
In order to add data to a Slicer, please drag and drop the filter field to the Fields section. Let me add Country to the Fields section.
For the demo purpose, let me select United States. From the below screenshot you can see that, the Stacked Column chart, Pie Chart, and Clustered Column charts are displaying the Sales for the united states.
TIP: By default, you can only select One field (Country) at a time. For multiple select, you have to toggle Single Select option from On to Off in the format section.
This time we selected United Kingdom. From the below screenshot you can see that, the filter is applied on all charts.
How to Format Power BI Slicer
Please click on the Format button to see the list of formatting options that are available for this Slicer.
Format Power BI Slicer General Settings
Use this General Section to Change the Outline Weight, Outline Color, X, Y position, Width and height of a slicer
Format Header of a Slicer in Power BI
As you can see from the below screenshot, we added Background Color, Outline to bottom. Next, we changed the text size to 20, and Font family to Georgia.
Format Items of a Slicer in Power BI
We changed the Items (Countries) font color to Green, text size to 20, and Font family to Georgia.
Format Power BI Slicer Title
By toggling the Title option from Off to On you can add a title to the Slicer.
From the below screenshot you can see, we added the Title Text as Countries Slicer in Power BI. Next, changed the Font Color to Red, Title Alignment to center, Font Family to Georgia, and Text Size to 19.
Format Power BI Slicer Background Color, and Borders
You can add Background color to a slicer by toggling Background option to On. For the demonstration purpose, we added a random color with 66% transparency.
Similarly, you can add Borders to a slicer by toggling Border option from Off to On.
Format Power BI Slicer Selection Control
This section has two properties:
- Show Select All: This will add Select All option to the Slicer.
- Single Select: This will restrict the slicer selection to one item at a time.
Let me toggle the Show Select All option from Off to On. Now, you can see Select All under the Country Slicer
By toggling Single Select option from On to Off, you can enable the slicer to select multiple fields.
Let me select Australia, Germany, United Kingdom, and United States.