In Part 2 of this series, I will cover Two-way filters. The term “two-way” sounds like you get only two opportunities to select a value, but this is not the case. The first value selected will automatically filter all of the objects with either the same data source or mapped data sources on the page. Then all subsequent value selections will filter all objects on the page including the first source object with an AND condition.
This type of compound filter is especially beneficial for exploring multidimensional or hierarchical data easily. This is because the objects can display different levels of hierarchy and the filtering will simultaneously be applied and you can continue to dive into the hierarchy or dimension.
For the entire series see the below articles:
My recommended way to use Two-way filters is not the traditional prompt to filter objects set up. I recommend creating hierarchies that you want to explore and use objects that support hierarchy Role assignments and add objects that provide you additional detail that you want to explore. For additional information see the SAS Visual Analytics Documentation for Two-way Filters.
For my first two examples, I will be using the SAS Help Cars data source. Since this is a widely understood product, it will be easy for you to understand the hierarchies and terminology.
Here’s a quick Crosstab of some of the values. You can see that the hierarchy: Origin – Make – Model is unidirectional. That means if I were to select a Model name it only has one Make and one Origin. The Type – Drive Train hierarchy, on the other hand, the order in which the user wants to explore those values can be interchanged. That means there is a many-to-many relationship between Type and Drive Train and I could start filtering at either value.
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
Enable Automatic Actions: Two-way filter
From the Actions pane, use the drop-down list to select the Page name. Then select to enable Automatic actions on all objects and choose Two-way filters. As you can see from the screenshot below, the option for Display filter breadcrumb will be enabled.
In this first example, you can see I have three objects: One Bar Chart and two List Tables. To see more detail and data, I used the Stacked Option on the Bar Chart. We will see how this helps us explain the behavior of the Two-way filter Action.
First Selection First, I will select the value Europe. The Bar Chart object has the Role assignments for both Origin and Drive Train. Therefore, the selected value Europe will be sent to filter the other objects on the page as well as all of it’s corresponding Drive Train values: Rear, Front, and All. We can see the applied filters using the filter breadcrumbs at the top of the page.
The second selection I made was from the top List Table where Origin equaled Europe and Type equaled Wagon.
These values are combined with the previous filter values with an AND operator and applied to all of the other objects on the page. We can see how the Stacked Bar Chart is now only show values for Europe and the bottom List Table has all of the filters applied:
The third selection I made was from the bottom List Table for Make equal to Mercedes-Benz and Model equal to E500. These are not the only values passed to the other objects on the page, all of the values for the List Table Role assignments are passed, however the other objects on the page aren’t displaying this level of detail.
I hovered over the Bar Chart so that you can see the frequency count of 1. Remember how earlier I mentioned that the Cars data source only has one unique Make – Model entry. So we can determine that the filters are being applied accurately.
We can also see all of the filter values being applied by using the Filter Breadcrumbs.
Another click path example
Cars Example 2
In this second example, I used a combination of hierarchies and different objects to illustrate additional ways you can use the Two-way filter to explore multidimensional data. Once the filters are applied, you will need to drill into the hierarchy for additional details.
Static screenshots don’t do these Actions justice, so here is a silent recording of a few examples of navigation.
One thing I learned from the above Cars examples, is that depending on the filter selections, the color palette assignment could rotate through different data values.
To prevent this, use the Rules pane to assign Color-mapped Display Rules so that the data value and color assigned are consistent throughout the filtering selections. For additional information see the SAS Visual Analytics Documentation for Working with Display Rules.
Color-mapped Display Rules
The best way to ensure that your category data item values are consistent throughout the entire report is to create a Report Level Display Rule. To do that, just create your color-mapped display rule and promote it to the report level.
Sometimes objects use the display rule in an unexpected manner. You may like the result, or you may not. The nice thing about display rules is that they layer with the object level display rule taking precedence. Notice in these screenshots how I added a white background display rule on the List Table to override the report level display rule.
But you can see when I change the List Table object to a Crosstab, we don’t have to worry about the row background color.
I had to switch data sources to demonstrate a Line Chart object since the Cars data source doesn’t have a time element to use. The nice thing about the Line Chart object is that it auto focuses when you filter. The main hierarchy I will explore is the time hierarchy which needs no explanation. There is also the Product Brand – Product Line – Product unidirectional hierarchy in this example as well as the Facility Region – Product Line hierarchy which has a many-to-many relationship.
Like before, instead of still screenshots, it’s much easier to gain understanding when seeing the live click paths. Here is a short silent recording of navigating through using Two-way filters.
As you have seen from these examples, using the Automatic Action: Two-way filters is a huge asset for exploring multidimensional or hierarchical data easily. While this feature may not be one to surface to your standard report consumer, it is ideal for the business analysts that understand the data source and needs to explore the data points for trends and/or anomalies to take action or initiate further research.
Remember to use the report level Display Rules to keep the categorical data values colors you are exploring consistent across your filtering. For the entire series see the below articles:
Find more articles from SAS Global Enablement and Learning here.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.