Ryan Sleeper
By default, Tableau only displays tooltips when hovering over measures. Ryan shares a trick that allows tooltips to be displayed on dimensions as well. This is an effective technique when you want to share additional information about dimensions with your audience.
Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to show you how to add a tooltip to a dimension. That is not the default behavior in Tableau. By default, Tableau only allows you to control the tooltips for measures on a view.
But not the dimensions or dimensional breakdowns on a view, which I think also has value, especially if you’re wanting to communicate additional information about that dimension, such as where it came from or what was the methodology to create that field.
To illustrate why this little hack is needed, I’ve built this simple bar chart over in the Sample Superstore dataset that looks at Sales and Profit Ratio by the Segment and Shipping Mode dimensions.
As we probably all know, if you hover over a data point in a Tableau view, you’ll see tooltips. Tooltips are the information that appear when you hover over the view. You can control those tooltips by clicking on the Tooltip Marks Card.
However, if I hover over a dimension member, notice nothing is showing up. That is not because I turned off the tooltips. It’s because tooltips, by default, do not show up for dimensions. That’s what I’m going to show you how to do.
We’re going to trick Tableau a little bit so that we can add tooltips to both measures, as well as dimensions. This is another application of one of my favorite tricks in Tableau, which is to build views using what I call a Placeholder field. And for that Placeholder field, I always use the formula MIN 0.
To show you how this works, I’m going to drag the Sales measure and the Profit Ratio measures off of the view, which leaves me with just the dimensions. But I’m going to create a four-column skeleton that we will then add to, to rebuild our chart, using these Placeholder fields.
To do this, you can double-click on the Columns Shelf. This is another way to use Tableau in the flow. We have a video here at Playfair Data TV under that name. If you want to give it a look, just look for 3 Ways to Use Tableau in the Flow.
But you can type formulas right here, directly on one of the shelves. And again, I always use the formula you see there, the aggregation of MIN, M-I-N, and then wrap 0. You don’t technically have to aggregate this.
In fact, I could just do 0 and click Enter, which will give it the default aggregation of SUM. But I just always like to make sure it is fixed at MIN 0. Just kind of a habit of mine. So whenever you see my Placeholder fields, that’s the entire formula.
Now that it is on the Columns Shelf once, I can replicate it by holding down the Control key and just dragging this right next to itself three additional times. And what is so important about this is, now that we’ve got four different measures– because 0 is quantitative. So technically it is a measure.
Because that is the case, each of those four Placeholder fields gets their own Marks Shelf. And those Marks Shelves can be edited independently of each other, including what fields are on the marks, or generating the marks, as well as what the mark type is.
So to recreate that bar chart I showed you during the introduction, I could make the first column a mark type of Text, the second column a mark type of Text, and then the third and fourth columns a mark type of Gantt Bar. This is how we’re going to recreate that bar chart.
Gantt marks have to be sized by something. So if I were wanting to recreate exactly what we started with, I could size the third column, or the first set of Gantt bars, by the sales amounts. So I will throw Sales onto the Size Marks Card.
And then for that last column, I will show Profit Ratio as the marks. So far, so good. For the text columns, I’m going to drag the same dimensions onto the Text Marks Card in their respective columns to recreate this.
So this first column, I’m going to put the Segment dimension onto the Text Marks Card. And for the second column here, I’m going to drag Ship Mode to the Text Marks Card. So I’ve essentially just recreated that two-column bar chart in a pretty rudimentary way.
Of course, I could format this further. But the foundation is there. I now no longer need the first two columns, because they’re just duplicating the names of the dimensions right next to them. So I will hide these headers, which you can do by right-clicking on either one and deselecting Show Header.
I’ll do that for both of those first columns. And here’s the trick. We see the name of the dimension members, but it’s technically being drawn as a measure, MIN 0. So I can modify the tooltip on that column.
I can say something like, this is the segment dimension. It comes from the XYZ database. And it was certified by Bob. And click OK. Now when the end user hovers over that dimension, they get the methodology, or more information on where it comes from.
I love this, because it helps build credibility with your data. The end user doesn’t have to look back and forth at a data dictionary. The information is just right there, in-line with them on the dimension. Really like that.
There is one little thing, though, about this chart that’s bugging me. And again, of course, you can format this further. Get rid of some of the 0 lines, add in some more grid lines to make this more readable. But the thing that’s really bothering me is the repetition of the names of the dimension members.
I have a little fix for that, too. First, create a calculated field. And this will be called First Row. And the entire formula is INDEX() equals 1. That’s just saying, we’re just isolating the first row. This is Boolean.
You’re either the first row, or you’re not. I’m going to click OK. And I’m going to drag that to the Color Marks Card for these first two columns. So I’ll drag the first row field to the Color Marks Card. Notice the first row has a different color than everything else.
By default, the addressing– INDEX() is a table calculation, which is why we see a delta symbol. And table calculations always have what’s called an addressing. By default, in this case, that addressing is moving from top to bottom. And it’s going across the entire table.
If you wanted to modify that addressing, you could click into that pill that has a delta symbol on it, hover over Compute Using, and choose something different. In this case, I want the first row to be isolated per each pane. So instead of the entire table, watch what happens when I choose Pane.
We now see the first row in each of the major rows, or what Tableau calls a pane, being colored something different. Now that those are colored something different, I can maybe make the ones that are False white so that you can’t see them. And those just fade into the background.
Now this looks like a traditional table. If you wanted to do the same thing on the second column, you could. In this case, you probably would want to see those breakdowns. But just to show you one more example of how this could be done, it’s yet another example of how to use Tableau in the flow.
I could just type in that formula directly on the Marks Shelf. So INDEX() equals 1. And by default, that calculation is put onto the Detail Marks Card. That’s what this icon is showing me.
Now that it is there, though, I can move that pill to the Color Marks Card. And I can do the same thing, where I change the addressing. Again, we want to see the breakdowns in this case. I’m just showing you another little trick, a way to use Tableau in the flow.
If I choose that, if I choose Pane (Down), I can now modify the colors so that only the first row is what we see on the table. And again, just like the first version I showed you, we can modify the tooltips, customize those however we want. That’s been how to add a tooltip to a dimensional in Tableau.
This is Ryan with Playfair Data TV – thanks for watching!