The Slicer visual
So now that we know that interactive filtering will always be an option for users, what do we do when our end users want to filter by something that isn't used inside our visuals? This is where the Slicer visual comes into play. The Slicer visual only allows one field to be assigned to it but, depending on what data type that field is, we will have different presentation options. The first option will be if we wanted to use a field of a String/Text date type. The second option will appear if we use any of the Numeric data types, which include: Decimal Number, Fixed Decimal Number, Whole Number and any of the Date data types. This second option is referred to as a Numeric Range Slicer. Let's take a look at these two different options with the visuals we already have.
Let's look at, setting up the visual:
- Select the Slicer visual and move it to someplace convenient within the report canvas. You can use the anchor points to resize the visual as you see fit.
- In our first example, let's add in the Temperature Range field from the Temperature table to our selected Slicer visual.
What we are seeing within our slicer is known as the List view. This allows users to see a distinct list of all the options they can now filter on from that specific field. For us, we can see that we now have four temperature options to choose from, and we can either single-select from our list, or multi-select. By simply left-clicking any of the boxes next to our options, we can see that both of our visuals become filtered based on the selected criteria. So, if we were to select the Cold option, the stacked column chart would be showing the Total Sales by Country when the weather was cold; see Figure 5-5:
Now, let's add another slicer to our current report page, which uses a field of a numeric data type, so we can explore the Numeric Range Slicer.
Let's look at, setting up the visual:
- Ensure that you have no other visual selected, and choose the Slicer visual once again. Resize and move the slicer to your liking.
- For this slicer, let's add the Year field from the Date (Order) table.
Immediately, you will see a very different presentation for our filter options. We have a sliding bar that can be moved from either side to give us a range of values, which will be used to filter the other visuals on our page. By moving the left slider one value to the right, we can see that the year 2005 has now been removed from our range and the data in our visuals have changed; see Figure 5-6. It should be noted that this slicer that we are using to filter by year could also be set to use the List format that our temperature slicer is using. Imagine, though, if rather than choosing the Year field as we did, we selected the Date field. The Date field has so many unique choices for filtering that using the List format would be impossible. This is really where the range format for the slicer makes the most sense. As well, there are a couple other formats available to us within the slicer. We can find those options in the upper right-hand corner of the slicer visual. Let's take a look at what those formats are and when they are available to us:
Format options from figure 5-6 are as follows:
- List: This option is available no matter what field you select. It is a distinct list of values from the selected field. This is better used when there is a small number of options to choose from.
- Dropdown: This gives the user a drop-down menu that will contain a distinct list of values from the selected field. This is very similar to the List option, but our choices are hidden until we hit the drop-down option. This is still meant for a smaller set of values so that users don't have to scroll through hundreds of choices.
- Between: Here we have the option from our second example using the Year field. This choice will only present itself for fields that are of a numeric data type, and this includes dates. It allows users to specify a range of values to leverage as the filter by the use of a sliding bar.
- Less than or equal to: Very similar to the Between option, but the sliding scale can only be adjusted from the left side.
- Greater than or equal to: This is the same as the previous option, except you can only adjust the sliding scale from the right side.
So, now we know a couple different ways to allow our users to filter the visuals we have created for them. Interactive filtering will always be there for our users, but we can take a more traditional route with the Slicer visual and present them specific options they would find meaningful to filter the data. The last thing we will do is rename this report page from Page 1 to Slicers.