For me, Sankey diagram is one of the most time-consuming viz to build. There are a lot of steps and many complex table calculations involved. So, for beginner or even intermediate Tableau users, the Sankey chart seems to be a very difficult challenge. For that reason, I would like to introduce an easier way to build Sankey chart. I won’t be diving deep into explaining the logic or the math behind this. What I will do instead, is to show how to implement the provided template in your visualisation to build the Sankey chart.
The template doesn’t belong to me. It is provided by The Flerlage Twins, Tableau Zen Master. They are my go-to source when I need inspiration or just simply to learn new techniques. I highly recommend you guys check out their blog, I guarantee you will learn a thing or two from these 2 Tableau Masters.
In this example, I will use the Superstore_Sample dataset which comes with Tableau.
- Open the Sankey template, then open your own data source, join that data source with the Sankey data source you just downloaded. Join the Sankey data source with your data source using a ‘calculated field’.
- Create ‘Step 1’, ‘Step 2’ calculated field using your preferred Dimension, create ‘Size’ calculated field using ‘Sales’, change the name from ‘T’ to ‘t (Model)’, change ‘Path’ to ‘Path (Model)’, create ‘Sigmoid’, ‘CalculationN’ calculated field.
Sigmoid: 1/(1+EXP(1)^-[t (Model)])
CalculationN: SUM([Size] )/98
- Replace the Data source, and Replace Reference of the ‘Size (1)’ to the newly created ‘Size’ calculated field above and then VOILA you have yourself a Sankey Chart.
You can use parameters to control the dimension for both sides of the Sankey chart. I will include the improved version you can download and have a look at.