How To: Dynamic Reference Band Using Set Actions




One of the greatest aspects of set actions is just how much more control you have over the user experience.  In this tutorial, I'll show you how to use set actions to dynamically highlight a max/min reference band, color lines, and create persistent labels on highlight.

First, let's build a basic line chart using the Superstore data.  We'll be looking at profit by category over time.



Then, we will create a set on Category.






Next, we will create a calculation so that we can color our lines on hover and then add it to the Color shelf.






We will also need to create calculations for the minimum and maximum reference lines.





Then drag these to the detail so that we can create the reference lines.  We will also set up the max and min for the reference lines.






Next, we need to create our persistent highlight label.





We are now ready to setup the Set Action that will drive the interactivity.






Now when hovering over a line, we get the max and min range, color, and persistent labels!





Feel free to download the workbook and comment with any questions.




How To: Connected Scatterplot Using Set Actions with Tableau




With set actions in Tableau, we are free to create all sorts of new UI/UX interactions.  This one is once again inspired by Rody Zakovich's amazing post on custom UI/UX.  With set actions it is very easy to implement a connected scatterplot on hover, and I'll walk you through how to build it.

In this example, I want to see profit vs sales with each year connected in the scatterplot.  To begin, we will build a simple scatterplot where each year's profit and sales are represented by category:


Next, we need to create a set for our categories:



Now we will create the calculations that will drive the connected line on hover through the set action.



Then we will drag both of these measures in and create a dual axis on both.



We will also need to synchronize the axes:



Make sure you change the Category Profit and Sales to a line and put the Year on the Path:


















Finally, we will setup the set action to create the connected scatterplot on hover.








That's all there is to it.  You should now have a scatterplot that connects the points on hover.  Feel free to download the workbook and comment with any questions.









How To: Create Expanding Bump Charts Using Set Actions with Tableau





Before we had set actions, Rody Zakovich wrote a post on custom UI/UX interactions that he had built in Tableau using data modeling techniques.  One of the interactions I really liked was the expanding bump chart.  Now that we have set actions, this is fairly easy to implement, and I wanted to apply it to one of my existing visualizations on the popularity of car color over time.

To start, we need to build a basic bump chart.  Here's a tutorial that will walk you through that.  Now let's start from the point of a basic bump chart.


The first thing we need to do is create a set for our colors since that is what we will be interacting with.


For this to work, we need to make a calculation that will size the circles when we hover over them.  We will make a simple calculation that checks if we are hovering over a color, and if so, we will make the circle 5 times bigger than the circles that we are not selecting.


We also need to make a calculation to display the ranking on the circle when hovering.


We now put Set Size on the size marks card and Color Rank Display on the Label marks card.



This step is optional and somewhat tedious, but I wanted the lines to be grey if they aren't selected and colored if they are.  So we can make a calculation for that as well.



This is tedious because once we have the set action working, we will need to make each selection and change the color.

Now to setup the dashboard action.  Click Dashboard/Actions/Add Action/Change Set Values and setting the action to update Set State on hover and keep set values when clearing the selection.



Now the bump charts should expand when hovering!




Feel free to download the workbook and comment with any questions.

How To: Create a Relative Map Using Set Actions with Tableau



One of the greatest analytical abilities that we gain with set actions in Tableau is that we can now create interactions that are relative to other data points.  It's all relative, right?  So how do we do this?  I'm going to walk you through creating a map that shows the profit of other states relative to the state you are hovering on.  Huge shoutout and assist to Corey Jones for the level of detail calculation and make sure you check out his blog for the latest in set actions.

The first thing we need to do is create a set that contains the states for the selection in the map:



Next, we will make a calculation that lets us compare the profit for each state relative to our selection:



We use the level of detail calculation to fix the profit of the selection and then we subtract that value from the other states that are outside of the set.  Here's how it works:



If we hover over California, we can see that the profit is fixed across the entire data set, and then each profit for each state is subtracted to create the relative profit.

I also wanted the states to show labels, but I wanted the state that was selected to be blank since it would be compared to itself.  The following calculation creates the labels:



Now we can build our map:




Finally, we add the set action by clicking Dashboard/Actions/Add Action/Change Set Values and setting the action to update Set State on hover and keep set values when clearing the selection.





That's it!  You should have a working map that is calculating relative profit.  You can use this to build any type of relative calculations using set actions as well.

Feel free to download the workbook and comment with any questions.