Power BI Slicer is commonly used to add filters to the canvas or to display filters on the report canvas. Let me show you how to create a Slicer in Power BI with an example.
For this Power BI Slicer demo, we will use the SQL data source that we created in our previous article. Therefore, see the article Connect Power BI to SQL Server to understand the Power BI data source.
How to create a Power BI segmentation
We will use this page to demonstrate the steps involved in creating a Power BI Slicer. This page contains stacked bar chart, clustered column chart, and pie chart.
To create a Slicer in Power BI, first drag and drop the fields you want to use as a filter onto the region of the canvas.
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. It will automatically create a map for you.
Click on the Slicer below the Display section. It will turn a map into a Slicer. In the screenshot below, you can see the list of countries.
Create a Power Bi Slicer 2 Approach
First, click on Slicer under the Display section. Automatically create a Slicer with dummy data, as shown below.
To add data to a slicer, drag and drop the filter field into the Fields section. Let me add Country to Fields section.
For the purpose of demonstration, let me select the United States. In the screenshot below, you can see that the stacked column chart, pie chart, and clustered column charts show US sales.
TIP: By default, you can only select one field (country) at a time. For multiple selection, you need to toggle the Single Selection option from On to Off in the format section.
This time we select the UK. In the following screenshot, you can see that the filter was applied on all charts.
How to format Power BI Slicer
Click on the Format to see the list of formatting options that are available for this Power BI Slicer.
Format Power BI Slicer General Settings
Use this general section to change the outline thickness, outline color, X, Y position, width and height of a cutter
Format a slicer header in Power BI
As you can see from the screenshot below, we added Background Color, Outline at the bottom. Next, we change the text size to 20 and the font family to Georgia.
Format Power BI Slicer Items
We changed the font color of the elements (countries) to green, the text size to 20 and the font family to Georgia.
Format Cutter Title
By toggling the Title of Off to In, You can add a title to the Slicer.
In the screenshot below, you can see that we added the title text as a country cutter in Power BI. Then change the font color to red, the title alignment to center, the font family to Georgia, and the text size to 19.
Format Power BI Slicer Borders and Background Color
You can add the background color to a cutter by alternating Background option a In. For demonstration purposes, we added a random color with a 66% of transparency.
Similarly, you can add Edges to a cutter by toggling the Border option of Off to In.
Format cutter selection control
The selection controls section helps you format the Power BI segmentation selection control. This section has two properties:
- Show Select All: Adds Select All option to cutter.
- Unique selection: Restricts the cutter 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 in the Country Slicer
Toggling Unique selection option from Enabled to Disabled, you can enable segmentation to select multiple fields.
Let me select Australia, Germany, the United Kingdom, and the United States.