Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Tableau Playbook - Area Chart in Practice Part 1

Jul 22, 2019 • 9 Minute Read

Introduction

This is the second part of a three-part series on Tableau Playbook - Area Chart. In the first part, we delved into theoretical knowledge of area chart. Check it out in case you missed it.

In this guide (Part 2), by analyzing a real-life dataset, Rossmann Store Sales, we will practice two of the typical area charts with advanced features step by step. Meanwhile, we will draw some conclusions from Tableau visualization.

Dataset

In this guide, we use the Rossmann Store Sales dataset from this Kaggle Competition. Thanks to Rossmann and Kaggle for this dataset.

This dataset contains three-year sales data for 856 stores in Rossmann. Store sales are influenced by many factors, including promotions, competition, school and state holidays, seasonality, and locality.

I have done data wrangling and feature engineering for this dataset. You can download my version from Github for a better exploratory data analysis.

Discrete and Unstacked

We will start with a discrete, unstacked area chart to analyze the effect of weekly promotion:

  1. Click on Show Me and see the request for the discrete area chart.

    For area charts (discrete), try 1 date, 0 or more Dimensions, 1 or more Measures.

    Hold down the Control key (Command key on Mac) while clicking to multiple select "Date", "Promo" and "Sales", then choose "area charts (discrete)" in Show Me. Tableau will generate a raw discrete area chart automatically.

  2. For a discrete chart, we'd better change to Entire View for a nicer visualization.

    discrete unstacked area chart 1

  3. In this example, we are going to analyze the weekly distribution. So we change "YEAR(Date)" to WeekDay from discrete Date Parts. If you are still confused about these concepts, you can refer to Date Part vs. Data Value in Line Chart.

  4. The "Sales" measure is aggregated as SUM, by default. But SUM is inappropriate here because the distribution is not balanced in promotion and non-promotion. By analyzing the distribution of sales, we can find out the data is skewed. Therefore, MEDIAN is better than AVG.

    Right-click "SUM(Sales)" and choose Measure -> Median.

  5. By default, Tableau stacks colored areas. Since we want to compare promotion with non-promotion, we should unstack them: navigate to Analysis -> Stack Marks -> choose Off.

    discrete unstacked area chart 2

  6. Since there are not too many data points, we can add well-formatted labels to them.

    discrete unstacked area chart 3

    1. Hold down the Control key (Command key in mac) which means make a copy and drag "MEDIAN(Sales)" into Marks - Label.
    2. Click Marks - Label to expand the option pane. Expand Font pane and check Bold.
    3. Choose Match Mark Color in the Font Pane.
    4. Expand Alignment pane and choose Top alignment in Vertical.
    5. Click Label to Right-click on "MEDIAN(Sales)" and click Format...
    6. Expand Numbers in Default Option. Click Currency (Standard) and change to English (United States) if you haven't.
    7. Then click Currency (Custom) and set Decimal places as 0.
  7. In the last step, let's polish this chart:

    1. Edit the Title to "Compare Weekly Sales by Promotion or not".
    2. Rename the color Legend.
    3. Right-click on "Date" and choose Hide Field Labels for Columns.

    discrete unstacked area chart 4

Analysis:

With the help of area, we can compare the distribution of promotion and non-promotion. We can see that Rossmann stores never promote on weekends. For weekdays, promotion performs the best on Monday. Let's deduce the possible reason. In my opinion, it may be because there is no promotion for two consecutive days and many stores choose to close on Sunday. Aided by hunger marketing, Monday's promotion is more attractive for customers who want to save money.

Continuous, Stacked, and Running Total

In this example, we want to analyze the composition of total sales grouped by different StoreType. So we will build a continuous stacked area chart with running total.

  1. Click on Show Me and see the request for the continuous area chart.

    For area charts (continuous), try 1 date, 0 or more Dimensions, 1 or more Measures.

    Hold down the Control key (Command key on Mac) while clicking to multiple select "Date", "StoreType", and "Sales", then choose "area charts (continuous)" in Show Me. Tableau will generate a raw continuous area chart automatically.

    continuous stacked running total area chart 1

  2. For this chart, visualization at the monthly level is appropriate: right-click "YEAR(Date)" on Columns Shelf and choose Month from continuous Date Values.

  3. Since we want to display the total sales accumulated over time, we right-click "SUM(Sales)" and choose Quick Table Calculation -> Running Total.

    continuous stacked running total area chart 2

  4. We have talked about the baseline issue, so we need to reorder the areas to make it easier for readers to observe data. We put the small ones underneath, as close as possible to the baseline. By doing it this way, more areas are able to compare with an "almost standard" baseline.

    In this example, we drag StoreType "b" to the bottom and drag "d" to the top in color Legend.

  5. Show drop lines for the detailed observation:

    continuous stacked running total area chart 3

    1. Right-click on the view and check Drop Lines -> Show Drop Lines.
    2. Right-click on the view again and click Drop Lines -> Edit Drop Lines...
    3. In the Drop Line Dialog, select Automatic in the Labels option.

    Now, when you click on the line, you can see the specific value of the current data point. However, you may notice the values on the drop-line show the cumulative value instead of the current StoreType value (shown in the tooltip). We will learn how to fix this in the next example. That is using an unstacked version.

  6. Put on the finishing touches:

    1. Right-click on the x-axis and click Format... Expand Dates in Scale Option from the Axis tab and choose Custom. Then customize the format as mmm yyyy.
    2. Edit the Title to "Running Total Sales by Store Type".
    3. Rename the color Legend.
    4. Remove the date axis title "Month of Date" in Edit Axis...

    continuous stacked running total area chart 4

Analysis:

Unlike the line chart, the area chart shows the cumulative impact, allowing the reader to better ascertain the contribution of each StoreType to the total sales. It focuses on the part-to-whole relation. With a quick scan, we can see the total sales contribution order is b < c < d < a.

Conclusion

In this guide, we have learned about area charts from practice. We drew two typical area charts to demonstrate a variety of features, such as discrete vs. continuous, stacked vs. unstacked, and accumulative mode.

In the third part, we will practice another two typical area charts with a variety of advanced features.

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 recnac@foxmail.com.