Filtering and Formatting
Interactive filters will allow our viewers to explore the data and engage with the visualization. We added one for Category to our map, but it currently only filters the map. It would be nice to apply the category filter to all the visualizations on our dashboard, and to use the map itself as a filter. We will also do a little bit of formatting to deal with the titles of our worksheets.
- Use a worksheet as a filter.
- Apply a worksheet filter to an entire dashboard.
- Add filters to context to fix filter ordering issues.
- Hide or change worksheet titles on a dashboard.
Turning a Worksheet into a Filter
In Tableau, it is possible to turn a whole worksheet into a filter for a dashboard. For example, if we make Map a filter, then clicking on a country will filter the data to only display mods from that country. This way our map will not only provide information, but also serve as a filter at the same time.
Start by clicking on the Map tile to make sure you have it selected. At the top on one of the sides there will be a small list of options starting with an X and ending with a downward arrow. Just above the arrow is a funnel icon, which is what we are looking for. Hovering over it produces the text: Use as Filter. Clicking on this will turn the map into a filter.
If you hover over the downward arrow below the funnel icon, you will see the text: More Options. Clicking on this arrow will open up a dropdown menu where one of the options is Use as Filter. If you have already clicked on the funnel icon, your dropdown menu will show a checkmark in front of this option.
You can try out the filter to see how clicking on various countries changes the rest of the dashboard. If you want to include mods from several countries, you can hold command (control for Windows) while clicking each country you want. When you are finished filtering, you can click any open spot on the Map worksheet to dismiss your selection(s).
You can turn any worksheet into a filter - this method will also work with the bar chart and scatter plots we created. I would recommend waiting until you have finished the tutorial until you try it, however, just in case.
Applying a Worksheet Filter to a Dashboard
While we were able to turn the map into a filter, this did not connect the Category filter to the rest of the dashboard. That is, if I select a category, the view on the map will change, but none of the other worksheets will be affected. We will have to change the filter behavior ourselves.
- Click on the Category filter and note the list of options on the top left or top right. This will be shorter than the map's list: Only an X and an arrow.
- click on the arrow for More Options.
- Choose Apply to Worksheets -> Selected Worksheets. This will allow us to decide which worksheets we will apply the filter to. Note that Only This Worksheet was the previous selection.
- In the window that pops up, click the button for All on dashboard. It will automatically check the boxes for each of the worksheets listed. We could check each box manually, but this option is more convenient.
- Click OK.
- Select a category from the dropdown menu and see how it filters everything on the dashboard now, not just the map.
Working with filters can be somewhat complicated. At the moment there is an issue with the filters on our dashboard, though it may be difficult to notice if you don't know exactly what to look for.
- Pick a category from the Category filter. I chose Models and Textures.
- Click on a country on the map. I clicked on the USA.
- Top Tags is behaving strangely. With the filters I chose there are only nineteen tags displayed.
What's going on? If only a few mods met my filter requirements, I might be inclined to say that there were only nineteen tags to pick from. However, the country and category I chose should leave me with enough mods that this potential explanation feels incorrect. In fact, what is happening is simply a result of the order we are applying each of our filters.
There are currently three filters being applied to the top tags bar chart. First, the filter we set when we created the bar chart is applied. This narrows our list of tags to the top twenty. From that list, we then apply the country and category filters. Thus, while the top twenty tags for our subset of mods may include different tags from the initial top twenty, only those initial twenty tags are considered. Instead, we want to apply the country and category filters before we limit our bar chart to twenty tags.
Fixing Filters for Top Tags
It is possible to adjust the order we apply filters to our data, but not from the dashboard. We need to go back to the Top Tags worksheet by clicking on the tab at the bottom of the application. Of the three filters on the Filters shelf, we want to add Action(Country) and Category to context. Adding a filter to context is a fancy way of telling Tableau to apply that filter first.
- Make sure you are on the Top Tags worksheet.
- Right click on the Category filter on the Filters shelf.
- Choose Add to Context. The filter will change from teal to gray.
- Do the same thing for the Action(Country) filter. The Filters shelf should show Action(Country) and Category as grayed out. The final filter, Tag should still be teal, as it has not been added to context.
- Go back to the dashboard. Top Tags should now show twenty sorted tags.
Fixing the Category Filter
We have fixed Top Tags, but this has caused us a new issue. Clicking on the Category filter reveals that the second option, just below (All), is Null. This is particularly distressing after all the work we did to add a null category filter and only display relevant values in the filter.
To illustrate why we do need to fix this, try selecting Null. While mod data is still displayed in the bar chart and scatter plots, the map goes completely blank. Leaving Null available to our viewers does not seem like a good option.
Fortunately, we can fix this issue the same way we fixed Top Tags.
- Leave the dashboard and go to the Map worksheet. One of the filters on the Filters shelf is already grayed out - the one we added to context from the bar chart worksheet.
- Right click on Category(null filter) and choose Add to Context.
- Go back to the dashboard and verify that Null is no longer an option.
Before we call our dashboard done, we should probably format a couple of the worksheet titles. Endorsements and Approval Ratio are useful and informative, but Map is rather pointless, and Top Tags could stand to be more informative.
- Right click on the Map title and choose Hide Title.
- Right click on the Top Tags title, but this time choose Edit Title.... Currently it is using the worksheet title as the title for the dashboard, but we can have it display any text we want.
- Change the text to: Top Tags by Number of Mods.
- Click OK.
We are now ready to move on to the finishing steps of the tutorial.