This week’s Tableau #WorkoutWednesday goal was to build a cross-highlight table using set actions. A recently released new feature, set actions allow you to dynamically add or remove dimension members to or from a set. So far, some common application focus around formatting, drill down, and comparisons that render on your viz dynamically based on user interaction.
To build the above cross-highlight table requires a few steps. The first component I built was a dynamic Y Axis and X Axis parameter/calculated dimension combination. A parameter is created with a fixed string value list of Region and Segment. In the calculated field, you can then use the parameter to determine which dimension should be displayed on the viz. The Y Axis calculated field is done in a similar fashion.
The next step involved creating two sets, one from the X Axis calculated dimension field we just created and one for the Y Axis.
I added a dimension value to each set for some testing…the “Central” Region and the “Art” Sub-Category. One additional calculated field is needed before building our viz, a Highlight Flag. It evaluates whether a row of data is in the Y Axis Set or the X Axis Set and assigns a value (1 or -1). The purpose of this field is to give the viz a flag to utilize for color.
Now that we have all the required pieces in place, time to build the viz. Tableau’s “Show Me” pane includes highlight tables out of the box. We’ll be using a variation of this to build the viz.
Instead of using our metric to color the highlight table, we’ll use the flag we created that tests whether a row is in one of our sets. At this point I still have the Central and Art values in the set. Changing my rows and columns to the dynamic dimension calculated fields, SUM(Sales) to a MAX of our Highlight Filter, and changing the color range from -1 to 1 gives the following viz (almost done).
After adding this sheet to the dashboard, we can incorporate the new set actions feature to dynamically change the set memberships. Instead of the hard-coded Central and Art members we used to test, hovering over any region and sub-category will change the set membership and therefore the color highlighting.
The final result looks something like the viz below. As you hover over a value, it is added to the set and therefore colored on the highlight table.