Two Ways to Make a Tableau Timeline when Events Overlap

Add context and discover new insights by separating overlapping marks

Timelines are a great option for adding context to visualizations like line graphs, but what happens when events overlap on the same day? This video offers two solutions for controlling the location of data points on the y-axis.

Calculated field that controls the location of marks on the y-axis (for up to 3 events):

MIN({FIXED [Date]: COUNTD([Event])})
(IF MIN({FIXED [Date]: COUNTD([Event])})=2 then -.5
ELSEIF MIN({FIXED [Date]: COUNTD([Event])})=3 then -1

Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to show you two different ways to create a timeline when events overlap. A Tableau timeline is one of my favorite chart types to make to provide context to my end users on why things might be performing the way that they are. For example, if you’re dealing with web analytics and you see a huge spike in direct traffic, if you look at that in a vacuum, you have no idea why that happened. If you can add a timeline to it that might include a series of big marketing events that might have driven that spike in performance, your end users are going to have a much better sense of what caused that spike. They’ll be able to analyze that better, perhaps take an action on it.

There’s a video here at Playfair Data TV that describes how to make a timeline in Tableau, but I’m going to show you a very quick and dirty way to do that just to illustrate this. For this tutorial I’ve got an underlying data source that just has a list of marketing campaigns in a fake company. This company is doing a big marketing push over the Tableau conference in 2019, as well as Black Friday, which follows the Tableau conference this year just a couple weeks later. So there is the full dataset.

To show you the quick way to make a timeline, I’m just going to throw my date field onto the Columns Shelf with a continuous day date part. Going to click OK. Make these circles a little bit smaller. But right now these circles represent each date in my dataset where some marketing event took place. So it’s already an improvement. If I were to align this onto a line graph that shows our web traffic, I would at least know which days had some marketing event take place. I usually, to help format this, will add a y-axis. And this is just a Placeholder field, I call it. The aggregation is always just MIN zero. That just puts everything on the same zero baseline, and you can format zero lines in Tableau by right-clicking and clicking format. It’s on this tab called Zero Lines. So just makes it a little bit easier to format a timeline.

But here’s the issue, and why we need this video. As we saw in the underlying data, there are several dates in this period that have multiple marketing events. But what’s happening is they are all overlapping each other on that zero baseline. We could do some traditional jittering by adding an INDEX field here. Maybe we’ll just give them three spots on the y-axis each. I’ll remove the zero for now just so we can take a closer look at this. This is jittering the data points from 0 to 2 on the y-axis. However I’m still not seeing any overlapping events. To do so I’m going to add the Event dimension to the Detail Marks Card.

And now we can see how many events there were on each date in my dataset. But notice they’re not lined up correctly, or at least how I would want them to be. That’s kind of confusing. This may be interpreted at first glance as a scatter plot. The y-orientation doesn’t mean anything and the data points aren’t even lined up, so it’s kind of a confusing chart.

This is the first way to handle a timeline when your events overlap. I’ve got this calculated field that I will share in the related content below this video. But I call this a Controlled Jitter. What this one does is it takes the index, or its position on the y-axis in this exact example, and it adds pieces of that index to move it up and down on the y-axis. This is saying per date, if there are two events, start at zero but minus 0.5. If there are three events, start at minus one. Otherwise, zero. So this scenario is setup for up to three events.

When there are two events, the index, it always goes in counts of one. So it starts at negative 0.5 on the y-axis. That’s where the first data point will be shown. It will then move up to 0.5, the positive on the y-axis, to make them perfectly synchronized on that zero baseline. When there are three events, it starts at minus one, so the first data point will be listed at minus one, the second data point will be listed at zero, the third data point will be listed at one.

And then it says else zero. So this is the case when there is just one event. That’s the third and final outcome. When there’s only one event, that one event will show up on the zero axis. So we’re just controlling its location so that everything is in sync. I’m going to click OK. And replace my index, my uncontrolled jitter, with my Controlled Jitter. And it still doesn’t quite look right. That has to do with the addressing. If I can change this addressing by clicking on that Controlled Jitter pill, hover over Compute Using, and instead of computing table across I want to compute by Event.

And now everything is lined up perfectly on that zero baseline. By the way, if you’re not familiar with addressing, I encourage you to check out the video An Introduction to Table Calculations in Tableau, here at Playfair Data TV.

So that was the first way. Second way, and by the way, that’s called– some people call it a bee swarm chart. I really like it. I think it’s very engaging. I used this in one of my visualizations recently called BLOCKBUSTER, but the main objective is to show when there are multiple events. The y-axis is still arbitrary and doesn’t mean anything. So, in fact, I would probably recommend that you hide that header by right-clicking on it and deselecting Show Header, because that doesn’t mean anything.

If you’re nervous that your audience will misinterpret this and think that that location on the y-axis means something, I’ve got a second scenario for you. In order to make this one, I’m first going to put the Number of Records for the y-axis. And by default, if this were automatic– So if you were making this for the first time, the chart would look like this. So we would be back to– we’ve got multiple events on certain dates, but we can’t see them because they’re all overlapping. To fix that, all you have to do is go to Analysis, hover over Stacked Marks, and click this On. And now these will be stacked on top of each other.

This one is a little bit more practical, probably a little better best practices, if you want to say that, because it’s now not only showing you when there are multiple events, but the location on the y-axis means something. This is also called a unit histogram or a Wilkinson dot plot, but now you can see at a glance not only which dates had multiple events, but you can read this essentially like a bar chart or a unit chart, where the higher the circles are the more events that took place on those dates. But either one of these, the first I think is a little bit more engaging, second one is a little bit more practical. The choice is up to you. But both of them achieve the objective of showing your audience when there are multiple events happening on the same date on a Tableau timeline.

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

Tableau Tips & Tricks Videos

Join Playfair+ Today

All members receive exclusive access to over 160+ videos and counting across eight learning paths.