Have you ever wanted to build a fancy chart in Tableau but don’t know how to start? In this case, using a template is a good starting point. Here, I want to share three simple steps to build your chart based on a template.

  1. Structure your data in the same format that the template needs to consume.
  2. Replace template data with your data
  3. Fix the broken fields through right-click and select “Replace References…”.

To demonstrate the three steps, I will build a Sankey chart for Tesla Q2 2021 earnings, based on a Sankey Funnel Template. I had the idea to do this when I came across a nice Peloton earnings Sankey chart, which was made by Joe Kernaghan, a UK Data Schooler from DS21. I found it interesting, so I decided to build one for Tesla.

Step 1: Data construction

To use a template, your data needs to be structured in the same way as the template data, so that all chart configurations and calculations are applicable to your data.

For the Sankey Funnel Template I use, I need to structure the Tesla earnings into 5 steps to correspond to the 5 levels of the Sankey.

The Link column shown above is created to implement cross join with a “Model” table that is needed for the Sankey charts. You can find the Model table in the “Sankey Template Multi Level.xlsx” file shared by Kevin & Ken Flerlage, the authors of the template. See here for more information.

Step 2: Replace template data

Once we have constructed the data, we simply need to replace the template data with our data. Here, I mimicked the template data and implemented a cross-join between the model table and the Tesla earnings table using the “Link” fields.

Step 3: Fix the broken fields

After replacing the data source, the charts are most likely to break. The reason is apparent. The old fields used to build the visualisations no longer exist. What you need to do is to find the broken fields (not the calculated fields), then right-click and select “Replace References…”, select the corresponding fields in the new table to fix the reference.

Since I’m doing this the second time for blogging purposes, it seems that Tableau has remembered how to reference the fields with the same name. I only need to refer the “size” field to the “value (M)” field to solve all the problems. But when I did this for the first time, there were more broken fields that needed to be fixed. After fixing the broken fields, you will have your Sankey chart!

Of course, the current viz is not well organised. You can make your own decision on how to format it. Please see the featured image at the top of the blog for my final viz.

Binbin Chen
Author: Binbin Chen

Binbin came to Australia and studied mechanical engineering at Monash University. After earning a bachelor's degree, he pursued a PhD degree and worked as a part-time teaching associate at Monash University during the period. When analysing data in research projects involving human eye movements, he discovered his enthusiasm for data. He was delighted to learn about Data School Down Under as it provides a unique opportunity to start a career as a data analyst through a thoughtful training program. Outside of work, Binbin enjoys watching historical and political videos. He is also an anime fan!