cft

Building Sankey Charts- Storytelling with Data

What are Sankey charts and how to create them in Tableau


user

Aasavari Kaley

3 years ago | 2 min read

“ 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

Image Source: https://www.ifu.com/en/e-sankey/energy-management/
Image Source: https://www.ifu.com/en/e-sankey/energy-management/

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.

Image Source: https://www.edwardtufte.com/tufte/minard
Image Source: https://www.edwardtufte.com/tufte/minard

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.

Image Source: https://community.qlik.com/t5/Qlik-Healthcare-User-Group/Visualizing-Paths-and-Flow-with-Sankey-Diagrams/td-p/1489571
Image Source: https://community.qlik.com/t5/Qlik-Healthcare-User-Group/Visualizing-Paths-and-Flow-with-Sankey-Diagrams/td-p/1489571

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.

Image Source: https://communities.sas.com/t5/SAS-Visual-Analytics/Patient-Flow-Sankey-Diagram/td-p/475320
Image Source: https://communities.sas.com/t5/SAS-Visual-Analytics/Patient-Flow-Sankey-Diagram/td-p/475320

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.

Image Source: https://www.canadianmoneyforum.com/threads/cash-flow-sankey-diagram.130009/
Image Source: https://www.canadianmoneyforum.com/threads/cash-flow-sankey-diagram.130009/

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.

Stay tuned for more such articles in and around data!

Happy Analyzing…

Link to the original article on Medium: https://medium.com/swlh/building-sankey-charts-storytelling-with-data-a98680131152

Link to Author’s website: https://aasavari-kaley.medium.com/


Upvote


user
Created by

Aasavari Kaley

Data Enthusiast | Avid Data Blogger | Medium Profile: https://aasavari-kaley.medium.com/


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles