How to create a cross highlight action in Tableau

Another #WorkoutWednesday challenge and Rody’s back. One of the reason’s I really like #WorkoutWednesday is the authors do a great of creating challenges to:

  • Challenge you to grow your technical skills
  • Explore new or lesser known functionalities of the Tableau

This week is no exception as Rody is challenging us, piggy-backing off of last week’s theme, to use set actions.

Rody would like us to create a crosstab table with highlight actions for each row and column. Rody mentioned in his intro that he’s gone down this road in previous versions but required additional data modeling and as a result was taxing on public servers.

But with the new Set Action feature, it’s so much easier!

Here’s our challenge:

Simple enough. Create a parameter driven crosstab and add an action to highlight the entire column AND row of the active cell.

Step 1:

Let’s create our parameters

Screen Shot 2018-11-07 at 1.49.53 PM

For sake of reduncacy, you’ll duplicate this parameter but change it the y axis options

#PROTIP: When I’m dealing with parameters of this type, I prefer to numerically number my parameters values. I do this because this makes it easier to swap dimenisons in the proceeding calculation much easier depending on stakeholder need.

Step 2

Let’s create the calculated fields based our parameter selections. There are lots of ways to do this, here’s my way

CASE [X axis]
WHEN 1 then [Region]
WHEN 2 then [Segment]
END

Now that you see how I create my calculated fields for parameters, hopefully my #ProTip above is more clear. Now, in your professional role, if you’re asked to change the dimensions of a parameter select you only need to update the paramter “Display As” values and the calculated field dimenions. Or, more likely, you’ve been asked to ADD additional fields its much simpler this way.

Okay, similar to step 1, you need to duplicate this field and change the dimensions to reflect those in the [Y axis] parameter.

Step 3

If you haven’t read my post from last week, in order to make set actions work you need…Sets! So let’s create some. Any guesses what we’re about to do?

Create a set based on each newly calculated field. The most important step here is that the sets need to be empty.

The way set actions work is by making selections on a view which Add members to a set

So we initially want our sets to be empty because we’re going to tell Tableau which member to INCLUDE in our set and then perform some sort of action.

And then we need to…yep, duplicate this process for the other calculated field.

Step 4

Now we need to deal with the highlighting. By looking at Rody’s screenshot, I can see what appears to be a binary color heatmap. And when I see heatmaps, I know that I have to have a continuous measure on color and mark type set to square.

I can also see that it’s only 2 colors, white and grey (could easily be any two colors you want…as long as they meet accessibility requirements, right? I should see nodding heads and no red-green color palettes). If you’re curious, yes I have an education background 😉

And let’s remember that this highlighting will be driven by our impending set actions we build.

Here’s the calcution I used to achieve this

IIF( [Set x] or [Set y] , 1 , -1 )

Here’s why this will work. We asking Tableau to evaluate if my selection adds a member to [Set x] or [Set y], if either are true, then return 1 else -1.

Make sure this field is a continous measure field and now drop it on color, with Sum([Sales]) on Text/Label. While we’re at, go ahead and drop our [x] field on Columns and [y] on Rows.

Let’s format our color mark to look like the following

Screen Shot 2018-11-07 at 2.34.07 PM

What are doing here? We’re making a custom diverging palette set to white and grey. We need to hard code the rest because our [highlight] field will only have one value in by default.

When we click “OK” it’s not working the way we want until we create our action. Let’s do that now

Step 5

Let’s throw this bad boy into a dashbaord and set up our set actions. Yes, plural, remember we made 2 sets, so we need 2 set actions at a minimum. And guess what? When you create one…you…yes, duplicate it for the other set.

Screen Shot 2018-11-07 at 2.42.13 PM

Once you duplicate it for the other set, you’ll end up with something like this! Click the GIF for the interactive workbook.

Crosstab Highlighter

I hope you feel more comfortable with Set Actions. Now…

GO FORTH AND VIZ!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: