In this guide, we will focus on another dual axis line chart: Line Chart Dual Axis with Area. By analyzing a real-life dataset: Rossmann Store Sales, we will focus on how to build it step by step. Meanwhile, we will draw some conclusions from Tableau visualization.
In this example, we will compare the sales trend of a typical store in 2013 with that in 2014. We will use a dual axis chart with area to highlight the difference between these two years.
Build a discrete line chart first.
Keep only 2013 and 2014 for the years:
Currently, this chart displays the data from 856 stores. We want to focus on a particular store:
Build the dual axis with area to highlight the difference between these two lines:
Optimize the areas:
We want to color the area between two lines. Currently, line and area use the same dimension "Date". We need to make a copy and apply colors separately.
First, remove the current dimension "YEAR(Date)" in the second Marks Card.
Right-click "Date" in Dimension pane and choose Duplicate. Tableau will generate "Date (copy)".
Drag "Date (copy)" into Marks - Color.
Now we can change the area color. Click the inverted triangle of area color Legend and choose Edit Colors... Change the color of "2013" into White. Change the color of "2014" to the color you want, such as gray.
We can see the area overlap the lines. We need to move it to the back. Right-click right y-axis and click Move marks to back.
To avoid misleading graph, check Synchronize Axis to synchronize two axes.
Since the two y-axes are synchronized, we can hide the right axis by unchecking Show Header.
Polish the final chart:
Analysis:
In this chart, we compare the trend with lines and highlight the area between them. We can clearly see that the overall monthly trends are consistent. The sales of 2014 increased about $500 - $1000 based on 2013. The only difference is that sales of 2014 rose the smallest in March and the biggest in April, probably because sales exploded in March in 2013 and April in 2014.
In this part, we have learned how to create a dual axis line chart with area. First, we built a raw, discrete line chart. Then we filtered it by years and store. Next, we used the dual axis with area and customized the area. In the end, we dug out useful information from this chart.
In the fourth part, we will practice the line chart dual axis with bar.
You can download this example workbook Line Chart and Variations from Tableau Public.
In conclusion, I have drawn a mind map to help you organize and review the knowledge in this guide.
I hope you enjoyed it. If you have any questions, you're welcome to contact me at [email protected].