Online tableau training, tableau tips, & video tutorials

# How to Make Dynamic Bump Charts in Tableau

Preview

Instructor

Ryan Sleeper

### Take bump charts to the next level with parameters and dual axes

This tutorial shows you how to make bump charts in Tableau and a way to allow your end users to choose what is being ranked in the visualization.

Hi. This is Ryan with Playfair Data TV. In this video, I’m going to show you how to make bump charts but also how to make them dynamic so that you can parameterize how the number is being broken down. To start with, I’m going to show you a basic bump chart using a measure of sales. I’m just going to double-click sales. And I’m going to break that measure down by discrete month of order date, just to lay some foundation here.

I’m also going to look at this trend by this segment dimension. So I’m going to drag segment to color. So at this point, we’ve got a line graph– sales by discrete month of order date– and it’s broken down at a segment level of detail. To create a bump chart, you use a special table calculation called rank.

This is an example of a calculation that I like to make in the flow of an analysis, which you can do by just double-clicking on the measure. It kind of unlocks this X-ray vision. And you can navigate to the beginning of that formula and type this table calculation, which is R-A-N-K. I’m going to wrap this whole thing and click the Enter button.

And you saw something change. Its ranking the sales value, and I can see there’s a delta symbol on our measure now in the rows shelf, which indicates that there’s a table calculation happening. But with table calculations, they always start out with the default addressing, it’s called, which goes left to right. In this case, we’re wanting to rank our sales amounts each month by segment. So we need to change the addressing of this table calculation.

You can do that by clicking into the pill on the rows shelf, hovering over Compute Using, and changing it to the most granular level of detail in the view, which, in this case, is segment. When I do that, you can start to see this come together. With bump charts, I prefer for the number one rank to be on top, so I’m going to flip this scale. Instead of going three at the top, then two, then one, I’m going to reverse that scale by right-clicking on the axis, clicking Edit Axis, and changing the scale to be reversed.

Now you can see the axis goes from top down– one, two, three. This makes a lot more sense now. So the type of insight that you could see in a bump chart is, for example, home office was ranked third out of three the entire year. Really, we had a pretty steady trend, actually, with one swap in the month of October. The corporate segment flipped with the consumer segment. So the bump chart is working, but it’s not showing us a whole lot at this point.

What I’d like to do, instead, is create a parameter so that my end user can decide what the ranking is based on. So instead of breaking it down by segment, we’ll also allow them to choose to rank the sales by shipping mode as well as category. To do that, we’re going to create a parameter.

We’ll call this dimension selected. The data type will be string, because we’re going to allow the end user to eventually choose from three different words or strings. And because it’s such a specific list of allowable values, I’m going to choose this list radio button and type out my three choices. Segment was the first, ship mode was the second, and category was the third. Click OK.

This will do very little on its own. We need to give Tableau instructions for what to do with each of those three choices. And you can do that via a calculated field. So the last thing I need to do is create this calculated field. I’ll call this dimension selected again. Maybe add calc at the end so I can differentiate between the parameter and the calculated field. And for me, whenever I’m doing this parameter technique with different measures or dimensions, I like to use case when logic.

So the formula, in this case, will be C-A-S-E, the word case, the name of the parameter that I’m referencing, which is dimension selected. And then, on each line, I’m going to give Tableau instructions for what to display or use when each of those three texts, each of those three words, is selected. So the first one was segment. When segment is selected, then I want you to show the segment dimension.

With case when logic, I like to type one line of the code. And then CASE logic always concludes with the word end. So I like to type one line of code then end, just to make sure I’m on the right track. I’d rather know if there’s an error at this point, versus typing out 10 lines of code and then figuring out there’s an error, having to go look through 10 lines of code. But so far so good.

Now I’m confident to go back and type in the other two options, which were ship mode. So in ship mode, I want you to display the ship mode dimension. And when category is selected, then I want you to display the category dimension. I’m going to click OK.

Now, instead of coloring by segment, I’m going to color by this dimension-selected calc. So I’m going to drag dimension-selected calc to the color marks card. You’ll see this turn red. It’s because we no longer have segment on the view, and this table calculation is trying to do the addressing based on segment. So don’t panic. I know it looks red and it went blank, but it’s not a big deal. We’re just going to change the compute using again by clicking into the pill, hovering over Compute Using, and now choosing Dimension-Selected Calc.

Now we can see the view come back. It actually looks the same, and that’s because the current value of the dimension-selected parameter is segment, the same dimension that we started with earlier. To allow the end user to choose between the three allowable values that we coded in this parameter, there’s one last step, which is to show the parameter control. You can do that by just right-clicking on the parameter and clicking Show Parameter Control. When I do that, this filter-esque box appears. This is actually a parameter control.

And within that dropdown menu will be the three options that we coded in this parameter. So now, when I choose shipping mode, you can see the colors change. There’s now four lines instead of three. And when I choose category, we see three lines. Again, the colors change. There’s quite a bit more volatility in this ranking, which is why this was important. We just unlocked some more flexibility. The first breakdown wasn’t showing us much, but with this parameter control, we’re able to unlock this flexibility to look at it in different ways.

You could even take this a step further, and instead of using just the sales measure, you could also parameterize the measure selection as well as the dimension selected.

This has been Ryan with Playfair Data TV – thanks for watching!