Building Sankey Charts- Storytelling with Data
Building Sankey Charts- Storytelling with Data

“ Stories are just data with Soul “ — Dr. Brene Brown

What is a Sankey Chart?

Sankey chart named after the Irish Captain Matthew Henry Phineas Riall Sankey, who used this type of visual in 1898 shown below representing the energy efficiency of a steam engine.

Sankey diagrams are essentially, flow diagrams, which highlight flows in a system. Flows could be energy, costs, materials etc, depending on your use case. They are instrumental in drawing the viewers’ attention to chief contributors of the flow.

Below is an example of what a Sankey diagram looks like

The chart above shows a Sankey diagram that represents total collective energy and how it flows and is distributed into different systems in a factory. The thickness or width of the bands are indicative of the amount of energy distribution into each of the three forms, Natural gas, District heat and Power Supply.

The primary energy inputs from the left side of the diagram, and are differentiated into three forms. Here the major chunk of total energy seems to flow into Natural gas, based on its thickness or width, followed by Power Supply and District heat respectively.

Sankey Highlight

One of the most popular and highly regarded Sankey-ish diagrams is Charles Minard’s Map of Napoleon’s Russian Campaign of 1812. You can read more about this chart in this blog.

Although Sankey diagrams did not exist in 1869, when this visual was created by Minard, it still captured the concept of flows overlaying on a geographical map.

Where are Sankey Charts used?

People use it across industries and use cases, not limited to below.

In Healthcare

This Sankey diagram represents the hospitals present in different counties in California.

This Sankey diagram visualizes patients journey, from the first consultation to the surgery and emergency situations. The thickness of the flows indicates the flow or number of patients. I

In Finance

Sankey diagrams are also used to track cash flows and finances, helping keep track of inflows and outflows of expenses. Here the thickness of the bands determines the amount of inflow/outflow of finances.

How to create a Sankey chart in Tableau

Follow the steps outlined below to create your own Sankey chart in Tableau (note: I have used the sample superstore data to create the below data visualization)

Step 1 — Creating two Parameters, connecting the flows

Step 2 — Creating a Path frame and Path Bin for Data Densification

You can read more about the data densification concept here.

Step 3 — Creating a Path Index

Step 4 — Creating a Sigmoid Curve

Create calculated fields like below:

Step 5 — Creating Sankey Arm Size

Step 6 — Top line calculated fields

Step 7 — Bottom line calculated fields

Step 8 — Sankey Polygon calculation

Step 9 — Preparing the worksheet

Step 10 — Nested Calculations

Add secondary calculations on the Sankey Polygons field you pulled on the Rows shelf.

Step 11- Create stacked bar charts

Left Pillar:

Right Pillar:

Step 12 — Pull all the 3 sheets into a dashboard

Format the dashboard to your needs.

You can find and download this dashboard from Tableau public.
['Aasavari Kaley']
['Data Visualization', 'Tableau', 'Data Science', 'Data', 'Data Analysis']