Just for some variety, check out this simple and fun blog about create Layered Area Charts in Tableau. We are literally using our data to draw the area chart using polygons, and then positioning them on the canvas. I hope you enjoy this and have loads of fun.

Note: This is an alternative type of data visualisation, and sometimes pushed for by clients. Please always look at best practices for data visualisations before deploying this into production.

Data

Download and load the following data into Tableau Desktop / Tableau Public.

Calculated Fields

With our data set loaded into Tableau, we are going to create the following Calculated Fields and Parameters:

X Distance Parameter

  • Set Name as X Distance.
  • Set Data type as Integer.
  • Set Allowable values to Range.
  • Set Minimum to 1.
  • Set Maximum to 20.
  • Set Current value to 20.
  • Click OK.

Y Distance Parameter

  • Set Name as Y Distance.
  • Set Data type as Integer.
  • Set Allowable values to Range.
  • Set Minimum to 1.
  • Set Maximum to 100.
  • Set Current value to 50.
  • Click OK.

Race Index

INDEX()

TC_Estimate

WINDOW_SUM(SUM([Estimation]))

Index

INDEX()+([Race Index]*[X Distance])

Rows

(SUM([Estimation]) / TOTAL(SUM([Estimation])))+([Race Index]/[Y Distance])

Worksheet

We will now build our worksheet:

  • Change the Mark Type to Polygon.
  • Drag Race onto the Colour Mark.
    • Right-click on this object and select Sort.
    • Set Sort by to Field.
    • Set Sort Order to Ascending.
    • Set Field Name to Estimation.
    • Set Aggregation to Sum.
    • Close the window.
  • Drag Age onto Detail and manually sort:
    • Start
    • Under 1 year
    • 1-4 years
    • 5-9 years
    • 10-14 years
    • 15-19 years
    • 20-24 years
    • 25-34 years
    • 35-44 years
    • 45-54 years
    • 55-64 years
    • 65-74 years
    • 85 years and over
    • End
  • Drag Index onto the Columns Shelf, right-click on this object and select Edit Table Calculations
    • In Nested Calculations select Index.
      • In Compute Using select Specific Dimensions.
      • Check Race and Age, and ensure that Race is on top.
      • Set At the level to Deepest.
      • Set Restarting every to Race.
    • In Nested Calculations select Race Index.
      • In Compute Using select Specific Dimensions.
      • Ensure that only Race is checked.
  • Draw Rows onto the Rows Shelf, right-click on this object and select Edit Table Calculations…
    • In Nested Calculations select Rows.
      • In Compute Using select Specific Dimensions.
      • Check Race and Age, and ensure that Age is on top.
      • Set At the level to Deepest.
      • Set Restarting every to None.
    • In Nested Calculations select Race Index.
      • In Compute Using select Specific Dimensions.
      • Ensure that only Race is checked.

If all goes well, you should have the following:

You can adjust the distances using the X Distance and Y Distance Parameter, so why not have some fun with that… however, we will now adjust the cosmetics.

  • Keeping the Ctrl (or Command) button pressed, click and drag Rows to the right to duplicate this object with all settings.
  • In the Rows (2) Mark Panel, change the Mark Type to Line.
    • Right-click on this object and select Dual Axis.
    • Right-click on the Rows Axis header and select Synchronise Axis.
  • In the Rows Mark Panel, click on Colour and change the Opacity to 50%.
  • Now with the formatting:
    • Set Row Divider to None.
    • Set Column Divider to None.
    • Set Grid Lines to None.
    • Set Zero Lines to None.

If all goes well, you should now be looking at the following:

Now I want you to change the Parameter settings for the layered effect.

  • Set X Distance to 4.
  • Set Y Distance to 100.

Play around with the Parameters and tweak to your taste. As the last step, I want you to edit the Tooltips, and add a label at the end of the Line. You will want to end up with the following:

and boom, we are done, you can find my data visualisation on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/LayeredAreaChart/LayeredAreaChart

Summary

I hope you all enjoyed this article as much as I enjoyed writing it and as always do share the love. Do let me know if you experienced any issues recreating this Visualisation, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic.

If you want to learn more about Creating Bespoke Data Visualisations in Tableau, do check out our course on Udemy at https://www.udemy.com/course/creating-bespoke-data-visualisations-in-tableau

4 COMMENTS

  1. Toan, Thanks for the tutorial on this! I followed along, and got mine to look just like yours, with one exception. I can’t get the label for the top calculation (Non-Hispanic White) to show up outside the mark like yours does. Mine appears to be centered on the mark. Any advice?

  2. Many thanks for the simple and clear instructions Toan. I have just easily replicated your example and look forward to bringing it in to practice within some of my own workbooks sometime soon …

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.