8 analytic concepts to express with Tableau set actions
Released in Tableau 2018.3, the set actions feature extends the interactivity in Tableau, allowing for deeper, more diverse comparisons through user selections and opportunities to see your data in a new light. Now you can provide richer analysis, more flexible exploration, and simpler user experiences for your stakeholders. For an introduction on how to bring powerful new comparisons to viz audiences with set actions, read more here.
Set actions make interactivity more expressive, providing precise control on dashboard design without any programming. They enable users to design a variety of custom responses to end user interactions. It’s now possible to coordinate different behaviours across multiple visualisations with a single selection, creating nearly endless compositions.
Filter actions vs. set actions
Interaction with a visualisation is often equated with filtering, but filtering is just one type of response to user selections. Sometimes you may want to:
- Find all items that are related to a selection, instead of keeping only the items that exactly match
- Keep items that meet any of the selection criteria instead of all of the selection criteria
- Sort, align, group, or drill down on a selection while retaining the context of the remaining data
- Hide data instead of filtering so that you can use it in calculations
While filters only keep data that is in a selection, sets group data into two groups—in or out of a selection. In fact, filters are a just special type of set. In principle, sets can express anything that filters can express, but the reverse is not true.
The set action feature means that end user selections in a visualisation can be stored in a set. Since sets can be nested or used in calculations, authors can design more expressive interaction behaviours, such as OR filters and filtering on relationships. This opens up solutions to problems like market basket analysis. In the videos shared below, I'll be demonstrating end-to-end user flows with specific scenarios that you may encounter, such as filtering on relationships, sorting and aligning on a selection, OR filters, dynamic grouping, and computing table calculations. You’ll also learn how to:
- Represent concepts like relationships and overlap through interactivity
- Use Tableau to think through calculation authoring
- Apply tips and tricks to design and colouring
You can follow along using the data sources here and bulk download the workbooks here.
Example 1: Filtering on relationships
Concept: Some data encodes meaning, while other data encodes relationships. Humans make selections from the type of data that encodes meaning. For example, a user is much more likely to ask, "Which teams were part of Brazil's group in the 2018 World Cup?" than, "Which teams were part of group E?" The group is only interesting because of the teams being examined. While filters always select the value the user picked, sets can select other fields based on their relationship to the user selection.
Data Source: 2018 World Cup Match Results
Scenario: For a selected team, how many games did they play and to whom did they win, lose, or draw? How many goals did each team score and how many goals were scored against them?
Interpretation: When selecting a country, the number of goals scored by and against each team reverse, so that goals scored is reported relative to the selected team.
Noteworthy: Market Basket Analysis can be solved in exactly the same way, with Order ID instead of Game ID, and Product instead of Team.
Example 2: Sorting and aligning on a selection
Concept: Stacked bar charts are often used as a way to compare each part's contribution to the whole. While the first segment and total value are comparable across bars, the inner segments are difficult to compare as they're not on a common baseline. Interactivity solves this problem, by sorting and aligning on a selected segment.
Data Source: 2017 - 2018 Stock Ticker Data
Scenario: How often is each stock increasing or decreasing, and by how much? Which stocks are most volatile? Which are least volatile? Which increase most often? Which decrease most often?
Interpretation: Each bar represents the distribution of daily change by stock. Large red segments means the stock often decreased, while large purple segments means the stock often increased. The intensity of the colour represents the intensity of the change. Sorting on different segments answers superlative questions on volatility, magnitude, and direction of change.
Noteworthy: While the bar lengths are always identical across stocks, selecting one or multiple bins realigns the bars against the minimum selected bin.
Example 3: OR logic applied across selection criteria
Concept: While filters always apply the AND operator across selections, sets can apply the OR operator across selections.
Data Source: Normalized London House Price Data (1995-2018)
Scenario: What proportion of properties have a selected estate type OR are categorised by a selected property type? What proportion meet both criteria? Of the proportion that meet only one criteria, what percent meets the estate type criteria and what percent meets the property type criteria?
Interpretation: OR conditions combined with a percent of total calculation enables you to analyse the overlap across selection criteria. For example, there's a strong overlap between freehold and terraced properties, while there is almost no overlap between freehold and flat, though almost all properties meet one of those two criteria.
Noteworthy: While adding filters always reduces the number of records, adding sets with the OR condition increases the number of records in the result set.
Dynamic Grouping
Example 4: Merging levels of detail
Concept: Often data is structured in rigid hierarchies, while analysis requires merging different levels of detail into a single field. For example, sales managers often want to see quota attainment for individuals on their team compared to aggregate quota attainment for other teams.
Data Source: Market Value of Players and Teams in the 2018 World Cup
Scenario: For a selected group, what is the average player market value by team? How does this compare to all other group averages?
Interpretation: Germany’s average player market value is higher than all other group averages, while the other teams in its group—Sweden, Mexico, and South Korea—are below all group averages. Mexico and Sweden did very well to make it to round 16 above Germany!
Noteworthy: This technique allows you to simultaneously compare the variance within a group to the variance between groups.
Example 5: Selection vs other/ conditional aggregation
Concept: While filters remove unselected categories, sets can group unselected categories into “Other”.
Data Source: Normalised London House Price Data (1995-2018)
Scenario: What is the trend of normalised house prices broken out by selected districts versus the average across all other districts?
Interpretation: Every time an additional district is selected, it is removed from the Other category.
Noteworthy: With filters, clearing selections displays a separate time series for each category. With sets, clearing selections displays aggregate data. This technique is a particularly useful when the selection domain has a large number of categories.
Example 6: Single member drill down
Concept: Expanding a subset of categories allows you to make comparisons across different levels of detail on a single scale.
Data Source: Market Value of Players and Teams in the 2018 World Cup
Scenario: What is the average player market value for teams within a selected group or players within a selected team compared to group averages?
Noteworthy: Rates are comparable across levels of a hierarchy, while magnitudes and quantities often are not. For instance, it is uncommon to compare an individual's value to total team value, unless the intent is to highlight exceptional individuals. For example, Lionel Messi has a higher market value than the entire Russian team. Be sure to consider the type of measure and the intent of the analysis when using this technique.
Order of operations
Example 7: Compute rank before filters
Concept: Table calculations such as ranking functions are always applied after filters, on the result set in the visualisation, however in some cases, you may wish for table calculations to compute before filters.
Data Source: Market Value of Players and Teams in the 2018 World Cup
Scenario: For a selected country, what is each player's rank within their team, region, and overall?
Interpretation: Lionel Messi is ranked first in Argentina, South America, and globally. Harry Kane is ranked first in England, first in Europe, but second globally. Kylian Mbappe is first in France, second in Europe, and third globally.
Noteworthy: Rather than filtering by the selected team, the set capturing the selection partitions the player detail view and hides the countries that are out of the set. This ensures that ranks are computed across all data, not only the visible data.
Example 8: Computing moving averages across data that is removed from the view
Concept: Time series analysis often requires filtering to a specific time range, while including data from prior periods in calculations.
Data Source: Normalised London House Price Data (1995-2018)
Scenario: Zoom into a time range to see the number of properties sold by week compared to the 52 week moving average of properties sold.
Noteworthy: A calculated measure returns the number of properties within the selected time range and null otherwise. Hiding the null measure causes the viz to auto-zoom to the selected time range.
Set actions make interactivity more expressive
Set actions offer power and flexibility to design more impactful interactive experiences. More control in the hands of creative users means audiences are engaged with custom experiences and richer analytics. While this post has introduced several examples, the potential is limitless and we look forward to seeing how the community will harness the power of set actions.
Discover more about set actions
- Tableau Desktop trial (needed for access to data sources)
- More set actions examples
- On-demand videos
- Tableau set actions: A roundup from Andy Cotgreave
For more tips, tricks, and vizzes by Bethany, check out her blogs and her Tableau Public profile page. You can also connect with her on Twitter @tablyze.
Related Stories
Subscribe to our blog
Get the latest Tableau updates in your inbox.