Ryan shows you how to: (1) make a traditional Gantt chart for project planning, (2) round the ends of Gantt marks by changing data types, and (3) create a formula for adding today’s date to a Gantt chart.
Hi, this is Ryan with Playfair Data TV. And in this video, I’m going to show you the easiest way possible to make rounded Gantt charts in Tableau. The Gantt mark has a lot of applications in Tableau. For example, it can be used to create a waterfall chart, among several other chart types. We have a chart type here at Playfair Data TV called a leapfrog chart. But their most traditional use is to be used in project planning.
So that’s the example that I’m going to build a Gantt chart with, first of all, and then I’m going to show you how to make it more engaging by rounding the ends of each Gantt mark. By the end of this video, you’ll be able to make something similar to what you see on the screen here where you’ve got your tasks going down from top to bottom and then that nice rounded Gantt mark at each phase of your project. I’m also going to show you an additional trick to show you how to add a reference line that shows today’s date. And we’ll color each task by its status, whether it’s complete, in progress, or not started.
This is one of the few chart types that the Sample Superstore data isn’t really built for. So I’m going to be sharing this data in the related content as a shared Google Sheet. That will allow you to follow along if you don’t have similar data to follow along with. So just look in the related content below the video. You can click the link. That will take you to the data that was used to create that rounded Gantt chart that I just showed you.
So let’s jump over to Tableau Desktop. And I first want to show you how to make a traditional Gantt chart in Tableau. It’s pretty quick to make as long as your data is in that structure that you see in the shared Google Sheet. But you start by adding your task to the Rows Shelf and your start date to the Columns Shelf. I highly recommend that you right click while you drag your start date to the Column Shelf. And that will allow you to choose the granularity of the date as well as if it’s discrete or continuous.
With a Gantt chart, you want the x-axis to be continuous. And because we want the start date to be on the actual day that each task started, I’m going to choose that very first option. Start Date continuous. And click OK. And I’ll fill the entire view just so we can end up seeing this a little bit better.
And the traditional method for creating a Gantt chart in Tableau involves creating a calculated field that subtracts the start date from the end date. So I will right click on End Date, hover over Create, and choose Calculated Field. That will save me just a few keystrokes, because it automatically puts the field that I right clicked on into the calculated field dialog. And I’ll call this Days to Complete Task. And the entire formula would just be End Date minus Start Date. Could also do a date diff or something similar to get this, but this simple formula should do the trick for us in this case. I’ll click OK.
Notice that Tableau has automatically set my mark type to Gantt bar. So that icon represents this mark type. And what we’re seeing so far is one, basically, you can think of that as the base of the Gantt at each start date. But in order to really get value out of the Gantt mark, they have to be sized by something. I’m going to size each of those marks by that newly created Days to Complete Task calculated field that I just created by dragging it to the Size property of the Marks card. That will now show not only the base of where we started, but it will push from left to right based on the number of days we have to complete the task.
So that is a traditional Gantt chart in Tableau, but we’re going to take this a step further and make it really engaging by making the ends of those Gantt marks rounded. I’m a big believer in making things more engaging. It adds credibility. It makes it more likely that somebody is going to stop and look at your work. And if you have more people stopping and engaging with your work, it’s going to improve the chances of somebody taking an action. So that’s why we’re doing this.
And it’s not hard. I figured out a very easy way to round the ends of those bars. I’m going to start a new version of this. And it involves a very simple change to the data type of my start date and end date. What we need to do is convert these to numbers instead of dates. To do that, I’m going to jump over to the data source and change the data type by just clicking on these icons at the top of each column.
If I click on Start Date and choose Number Whole, you’ll see that the date is converted to a serial number. This is used in data engineering even in tools like Excel. It will convert dates to number so that it can store those numbers and do calculations on those numbers. These serial numbers start on the date January 1, 1900, and then there’s just one tick mark each day that goes by. So for this first number, for example, this first date, we’re 44,732 days since January 1st, 1900.
I’m going to do the same thing for my end date. Change that to Number Whole. And jump back over here to the Authoring interface. You can see my dates are now numbers, but they also have to be measures. So I’m going to right click on each one and click Convert To Measure. So right click there. Right click there. Now these are under that horizontal rule, and they are classified as measures instead of dimensions.
Same first step to create rounded Gantt charts as we did with the traditional Gantt chart. I’m going to drag my task to the Rows Shelf. I’ll go ahead and fit the entire view again. But the difference this time is instead of using Start Date on Columns, I’m going to drag Measure Values to Columns.
And what we see here are the three measures in the data set, Start Date, End Date, and then it’s counting the number of records in this shared data set that I just made. We only need the Start Date and End Date. So I’m going to remove that one. And the trick here is I’m going to change the mark type from Bar to Line. Change that to Line. And this actually is working. It doesn’t look like it yet. But remember, those serial numbers are pushing us all the way out into the 40 thousands over here.
There’s a step that you need to do, which is to not include 0 in the axis, because remember, 0 in this case is the year 1900. Not relevant for our analysis. So I’m going to right click on the axis, choose Edit Axis, and just deselect Include Zero. And now we have a more appropriate range.
But these lines are not connected as anticipated. By default, Tableau is connecting these dots from top to bottom. So we have these two lines, but they’re not really very meaningful. To change the direction in which Tableau is connecting those dots, the easiest thing to do is move the Measure Names field from what’s currently on the Detail property of the Marks card over to the Path property of the Marks card, which we can do by just dragging Measure Names. Again, it’s on Detail. I know that because of this icon. If I move that to Path, you immediately start to see this come together.
We’ve already got rounded Gantt chart or Gantt bars. But to make that more evident, I’ll click on the Size property of the Marks card and drag that over to the right. You can see that nice shape coming together. I think that’s much nicer than those kind of big, bulky blocks that you just saw on the traditional Gantt chart in Tableau.
There’s a couple more things I can do with this. I typically when I’m doing project planning and using a Gantt chart, I like to show a reference line that shows where we are today. That way we can at a glance see if we’re ahead of schedule, behind schedule, and what’s in progress compared to today’s date.
To do so, you can create a calculated field that I call Today. And if you are doing this with a traditional Gantt chart, that would be the entire formula TODAY(). To convert that to a number, though, the serial number, you need– so if you’re wanting to make rounded Gantt charts, you would need to wrap TODAY() in the function called FLOAT. That will convert it to the same type of serial number being used currently on the x-axis.
I’m going to show you kind of the wrong way to do this or what this will currently result in, and then we’ll go back and we’ll fix it to make it more relevant for this current analysis. But just to show you how to apply this today reference line or calculated field to the view, I’ll stop there and click OK. And we need to add this as a reference line to the x-axis.
Well, to be available to add a field as a reference line, it has to be somewhere on the view. We currently don’t have the Today field on the view anywhere. But a trick for getting around that is to add it to the Detail property of the Marks card. As you will see, this will add that field to the view, but it won’t change the way the visual looks at all.
Now if I go to add a reference line, which you can do by either choosing a Reference Line from the Analytics pane or by right clicking on the x-axis and choosing Add Reference Line, that Today field will now be available in this dropdown. By default, reference lines default to the value of the axis that you’ve added it to. So in this case, we’re using Measure Values. Therefore, Measure Values is the current reference line. But if I use this dropdown, I can choose from any measure that’s on the view. So I’ve got Today, and I can select that.
And here’s what I meant by this not quite working yet. I have future proofed this data set and pretended that I’m planning a project that’s going to occur next year in the future. So this is working. This is today’s date as of this recording. But my tasks don’t start for over a year from now based on this recording. So it’s not very relevant at the moment.
To get around that and show you how this can work, I’m going to go back to my Today field and hard code a more relevant date into there. So instead of literally being today, because this will be dynamic, it will move as– every time you open the workbook, it will move to today’s date. So that’s what you want when you’re doing project planning.
For the purposes of this video, just to get something to show up, I’m going to add a hard coded date. And we’ll say it’s next year and I think July 5th would be a good one to try. It needs one more parentheses. And let’s click Apply and see how we did. It looks like it’s in the ballpark now. I’ll click OK. So now this reference line is showing up somewhere in the middle of my project.
A couple more formatting tips for you. Now that I’ve got this reference line working, I’m going to edit it, make a couple of formatting changes. I might change the label to not say Average Today. That doesn’t make a lot of sense. I’ll make that custom instead and just call that TODAY, all caps. I also like to usually make this line a bright color so that it stands out. And a nice touch is to add some shading below the line. I usually do a light gray shading that kind of shows you the history of where you’ve been. That’s over. It’s grayed out. And we’re focusing on the future and what the status is of each of these tasks. I’ll click OK.
These serial numbers also don’t– they just aren’t very meaningful, unless somebody is really into the numbers and the dates and the data. But I’m just going to hide that altogether. This reference line kind of shows you where we’re at. So it kind of provides that scale. And of course, you can always use tooltips to show the start date and the end date. That’s a good way to get– it’s a good alternative to showing this axis. So I’ll right click on that. Deselect Show Header.
And then I have a field in my project plan called Status. I might also drag that to the Color property of the Marks card. Give each of these status a different color. So if it’s complete, maybe we’ll put that in blue. In progress, that is maybe orange. And not started could be gray. We’ll click OK. And we’ve got ourselves a pretty nice rounded Gantt chart in Tableau. It was very easy to create, and I think it gives you a little bit of professional polish, makes this chart type very engaging. This has been Ryan with Playfair Data TV – thanks for watching!