Get startedGet started for free

Adding reference lines, trend lines, and forecasting

1. Adding reference lines, trend lines, and forecasting

Once again we are connected to the UN Health data and we're going to look at the monthly evolution of the number of births in Portugal over the past five years. Let’s start by building a line chart. We’ll do this as we've learned before. First, drag Date to Columns and Births to Rows, then go to the dropdown menu next to YEAR(Date) and select Month in the second section to ensure that it’s interpreted as continuous. Let’s also filter by dragging Country to the Filters shelf and selecting Portugal. Do the same for Years. We only keep the last five years and click OK. Great! Let’s take this line chart to the next level by adding a reference line indicating the average number of monthly births. To do this you need to go to the Analytics pane. Then, under Custom, you’ll see Reference Line. Drag this into the View. You’ll notice a grid with options appears. We want to apply the calculation across the entire table, the average over all months, and we want the average of the births measure. In the dialog box that opens you see that the default calculation is average so that’s perfect. Click OK. There we go. The reference line makes it really easy to compare how the number of Portuguese births compares to the average over time. There are also other options to enhance this chart. Let’s first remove the reference line. You can do this by clicking the line and then, Remove. Imagine we want to know if over the past five years there was an upward or downward trend in the number of births. It’s kind of hard to see based on this visualisation. Let’s add a trend line. Once again, navigate to the Analytics pane. Under Model you’ll see Trend Line. Drag it to the view and select linear. Don’t worry about the different models. For now, we will just stick with the linear one. There we go. Now you can see that overall there seems to be a slight upward trend in the number of births. There is another cool thing that you can do in Tableau. Imagine you want to have an estimate of the number of births next year. Tableau’s built-in analytics make visualizing this really easy. Let’s first remove the trend line. In the Analytics Pane you’ll see Forecast. You can drag it to the view and drop it on the forecast box. Now you can see the forecasted number of births for 2019. Cool right? Over to you.

2. Let's practice!