Sankey Chart in Tableau

What is the Sankey chart in Tableau?

A Sankey chart in Tableau is a data visualization tool that enables you to visualize data flows along with the relationships between different categories or groups. Using these charts, you can visually display the flow movement between two nodes or groups, the direction of flow, and the quantity or magnitude of flow. Such charts are very useful tools to perform analysis on transitional journeys or relationships. 

For example, user navigation through different pages on a website, the journey of different teams in a cricket or football tournament, interactions between different functions within an organization, etc. A sample Sankey chart is provided below. As you can see, this chart shows the progression of different football teams from the group stage to the final in UEFA Euro 2020.

Sankey chart in Tableau - Intro
Key Takeaways
  • A Sankey chart in Tableau enables you to visualize data flows along with the relationships between different categories or groups. 
  • It allows you to display the flow movement between two nodes or groups, the direction of flow, and the quantity or magnitude of flow which is a useful tool to perform analysis on the transitional journeys or relationships. 
  • The key components of the Sankey chart include Node (representing groups or categories), Level (to provide clarity and context to the nodes), and Link (direction of flow).
  • You can interact with the data in Tableau Sankey charts using the highlight feature.
  • Currently, there is no built-in Sankey chart on the Tableau desktop available for users. 

Components

The key components of a Sankey chart in Tableau include:

  • Nodes
    • It represents different categories or groups and has a start and end point of the flow
    • For example, product segments, organization sectors, Food categories, etc.
  • Link
    • It represents the arrows that connect different nodes, highlighting the direction of the flow.
    • The width of the link represents the magnitude of the flow.
  • Levels
    • Levels provide clarity and context to the nodes and links in the chart. These are texts you can add to the chart.

How to create a Sankey chart in Tableau?

To create a Sankey chart in Tableau, follow the instructions below:

Step 1: Connect your dataset to the Tableau interface using File – Open.

Sankey chart in Tableau - create - Step 1

Step 2: Create a Union by dragging the dataset sheet to the dataset in the view.

Sankey chart in Tableau - create - Step 2

Note that post union, two additional columns, Sheet and Table Name, were added to the dataset.

Sankey chart in Tableau - create - Step 2 - post union

Step 3: Click on Analysis – Create Calculated Field…

Sankey chart in Tableau - create - Step 3

Step 4: In the calculation editor, assign a name and calculation logic.

Sankey chart in Tableau - create - Step 4

Step 5: Right-click on the newly created calculated field (T). Click on Create – Bins…

Sankey chart in Tableau - create - Step 5

Step 6: In the Edit Bins screen, specify the new field name and size of bins to 1. Click on OK to save the changes.

Sankey chart in Tableau - create - Step 6

Step 7: Create another calculated field by specifying the logic in the calculation editor screen as shown below.

Sankey chart in Tableau - create - Step 7

Step 8: Create a calculated field, and rank it as a 1 field, by defining the logic using the RUNNING_SUM and TOTAL functions.

Sankey chart in Tableau - create - Step 8

Step 9: Right-click on the rank 1 field in the Data pane and select Duplicate.

Sankey chart in Tableau - create - Step 9

Step 10: Right-click on the new field and select Rename from the context menu to provide a new name to the field.

Sankey chart in Tableau - create - Step 10

The renamed field is now visible in the Data pane.

Sankey chart in Tableau - create - Step 9 - renamed field

Step 11: Create a new calculated field Sigmoid by writing a formula as shown below.

Sankey chart in Tableau - create - Step 11

Step 12: Repeat similar steps to create another calculated field Curve as per the formula provided below.

Sankey chart in Tableau - create - Step 12

Step 13: Drag and drop the Index to the Columns shelf and Padding to Detail in the Marks card.

Sankey chart in Tableau - create - Step 13

Step 14: Right-click on the Index field and select Compute Using – Padding.

Sankey chart in Tableau - create - Step 14

Step 15: From the Marks card, select Circle.

Sankey chart in Tableau - create - Step 15

Tableau will update the view using the chosen Marks type.

Sankey chart in Tableau - create - Step 15 - View

Step 16: Drag and drop the Curve field to the Rows shelf.

Sankey chart in Tableau - create - Step 16

Step 17: Drag and drop the Region and Category fields to the Detail in the Marks pane.

Sankey chart in Tableau - create - Step 17

Step 18: Right-click on the Curve field in the Rows shelf and choose Edit Table Calculation from the context menu.

Sankey chart in Tableau - create - Step 18

Step 19: In the Table Calculation screen, select rank 1 under Nested Calculations.

Select Specific Dimensions under Compute Using and then choose all the dimensions.

Sankey chart in Tableau - create - Step 19

Step 20: Similarly, repeat the same process for rank 2. While choosing the dimensions, rearrange the order as shown below.

Sankey chart in Tableau - create - Step 20

Step 21: Right-click on the horizontal axis and click on the Edit Axis.

Sankey chart in Tableau - create - Step 21

Step 22: In the Edit Axis screen, choose Custom Range. Specify the Fixed Start and End.

Sankey chart in Tableau - create - Step 22

Step 23: Similarly, right-click on the vertical axis and select the Edit Axis option.

Sankey chart in Tableau - create - Step 23

Step 24: In the Edit Axis screen, specify the Custom Range and define the Fixed start and end.

Sankey chart in Tableau - create - Step 24

Step 25: In the Marks pane, select Line as Marks Type.

Sankey chart in Tableau - create - Step 25

Step 26: Drag and drop the Padding field to Path in the Marks pane.

Sankey chart in Tableau - create - Step 26

Step 27: Navigate to Analysis – Create Calculated Field… In the calculation editor, specify the logic for defining the size.

Sankey chart in Tableau - create - Step 27

Step 28: Drag and drop the Size field to the Size in the Marks pane.

Sankey chart in Tableau - create - Step 28

Step 29: Right-click on the Size and choose Compute Using – Padding.

Sankey chart in Tableau - create - Step 29

Step 30: Adjust the size as required. Tableau will create the chart as shown below.

Sankey chart in Tableau - create - Step 30

Step 31: In the Marks pane, drag and drop Region to the Color.

Sankey chart in Tableau - create - Step 31

Step 32: Right-click on the Category and select Color in the Marks pane.

Sankey chart in Tableau - create - Step 32

Step 33: Right-click on the horizontal axis and select Edit Axis.

Sankey chart in Tableau - create - Step 33

Step 34: In the Edit Axis screen, adjust the range as shown below.

Sankey chart in Tableau - create - Step 34

Now, the Sankey chart is ready to be visualized.

Sankey chart in Tableau - create - Step 34 - chart

Note: Currently, Tableau doesn’t support any built-in Marks Type or visuals under Show Me for creating a Sankey chart. Initially, it was available in Tableau public as part of the beta program and is currently no longer available for public use.

Similarly, you can also create a polygon sankey chart in Tableau through workaround steps, which may require technical knowledge and multiple steps in Tableau.

Examples

In this section, we will demonstrate different scenarios where you can use the Sankey chart in Tableau.

Example #1

In this example, we will demonstrate creating a Sankey chart on the Tableau desktop using the Energy data – Sankey demo dataset. The Energy data – Sankey demo contains information such as Fuel Source, Fuel Type, Country of Usage, and Volume.

To create a Sankey chart in Tableau Desktop, follow the steps outlined below:

Step 1: Connect the Energy data – Sankey demo to the Tableau interface.

Example 1 - Step 1

Step 2: Create a Union of your dataset in the Data Source tab.

Sankey chart in Tableau - Example 1 - Step 2

Step 3: Repeat the steps outlined in how to create a Sankey chart in Tableau.

This involves creating the below-calculated fields.

Sankey chart in Tableau - Example 1 - Step 3
Example 1 - Step 3 - Index
Sankey chart in Tableau - Example 1 - Step 3 - Running
Example 1 - Step 1 - sigmoid
Sankey chart in Tableau - Example 1 - Step 3 - Curve
Example 1 - Step 3 - Size

Also, create a bin for the view.

Sankey chart in Tableau - Example 1 - Step 3 - bin
Example 1 - Step 3 - edit bin

Step 4: Repeat the processes outlined in the previous section to create a Sankey chart as shown below.

Sankey chart in Tableau - Example 1 - Step 4

Step 5: Add Padded to Path.

Sankey chart in Tableau - Example 1 - Step 5

Step 6: Add the Size field to Size in the Marks pane.

Sankey chart in Tableau - Example 1 - Step 6

Step 7: Change the Size to Padded.

Sankey chart in Tableau - Example 1 - Step 7

Step 8: Adjust the size and color in the Marks pane.

Sankey chart in Tableau - Example 1 - Step 8

Step 9: Edit the horizontal and vertical axes

Sankey chart in Tableau - Example 1 - Step 9

Step 10: Apply formatting to the chart.

Sankey chart in Tableau - Example 1 - Step 10

Post formatting, your chart looks like the one below.

Sankey chart in Tableau - Example 1 - Step 10 - Chart format

Step 11: In a new worksheet, create a visual by dragging the Volume to the Rows shelf and the Fuel Source to the Color in the Marks pane. Add Quick Table calculations.

Sankey chart in Tableau - Example 1 - Step 11

Tableau will create a chart as shown below.

Sankey chart in Tableau - Example 1 - Step 11 - chart

Step 12: Similarly, create another visual in a new worksheet for Fuel Type.

Sankey chart in Tableau - Example 1 - Step 12

Step 13: Adjust the Axis and header for each of these visuals, i.e., Fuel Source and Fuel Type.

Sankey chart in Tableau - Example 1 - Step 13

Step 14: Click on a New Dashboard. Drag and drop the worksheets as floating.

Adjust the shape and size of the sheets.

Step 15: Navigate to Dashboard and Actions. Specify the actions for your dashboard.

Sankey chart in Tableau - Example 1 - Step 14

Now your Sankey chart is ready for use.

Sankey chart in Tableau - Example 1 - Step 14 - Chart

Example #2

In this example, we will demo creating a Sankey chart using the Web Authoring feature in Tableau public using Superstore sample data that contains the sales details across different superstores in the US.

The step-by-step guide is provided below:

Step 1: Sign in to your Tableau public and select Web Authoring under Create.

Sankey chart in Tableau - Example 2 - Step 1

Step 2: Connect to Data using the Drop to upload feature.

Sankey chart in Tableau - Example 2 - Step 2

Step 3: Select the table to map in the Connections interface.

Sankey chart in Tableau - Example 2 - Step 3

Step 4: In the new worksheet, do the following. Change the Marks Type to Sankey.

Sankey chart in Tableau - Example 2 - Step 4

Step 5: Add the dimensions in the Data pane to Level in the Marks pane.

Sankey chart in Tableau - Example 2 - Step 5

Step 6: Add measures to the Link. This is in the Marks pane.

Sankey chart in Tableau - Example 2 - Step 6

Step 7: Adjust the level width and padding as appropriate for your chart.

Sankey chart in Tableau - Example 2 - Step 7

Example #3

In this example, we have expanded on example 2 to create a multi-level Sankey chart in Tableau public. 

To create a multi-level Sankey chart in Tableau, follow the instructions below:

Step 1: Connect the dataset to the Tableau public.

Step 2: Change the Marks Type to Sankey. Drag Category, Segment, and Region to the Level, and total sales to the Link in the Marks pane.

You will see a multi-level Sankey chart in Tableau public view as shown below.

Sankey chart in Tableau - Example 3 - Multi level

Important Things to Note

  • Tableau Sankey charts require the data relationships to be accurately defined to represent a meaningful chart.
  • If your dataset contains too many groups or categories, then Sankey chart is not recommended for visualization.
  • Ensure that you understand the limitations associated with the Sankey chart before you recommend its use.
  • Alternatively, consider using other data visualization tools that may be handy for displaying similar visualizations.

Frequently Asked Questions (FAQs)

1. Are there any best practices for designing effective Sankey charts in Tableau?

Some of the best practices for designing effective Sankey charts in Tableau include:

Ensure the data is suitably transformed for use in the Sankey chart with source and target columns.
Focusing on data flow and relationships between the categories using the links.
Consider adding labels appropriately to the categories and links to clearly explain the magnitude and direction of flow.
Use color-coding judiciously for the data visualization.
Make sure you add tooltips to the visualization to display critical information to the end users.

2. Can I interact with the data in a Tableau Sankey chart?

Yes, you can interact with the data in a Tableau Sankey chart through the below features:
Highlighting a portion of the visual when you hover over a category or link and display additional information through tooltips.
Filtering your dataset to change the visualization as per the filtered dataset.
You can also create actions for your visualization that can interact with the Sankey chart in Tableau.

3. Are there any limitations to creating Sankey charts in Tableau?

Yes, there are a few limitations to creating Sankey charts in Tableau. They include:

Technical knowledge 
Tableau does not natively support creating a Sankey chart, and you need to have technical know-how to build such charts. Hence, creating such charts requires a certain amount of customization and technical expertise.
Chart complexity
For large datasets, Sankey charts may not be ideal, as you may observe performance issues given the complexity involved in displaying the data flow. 
Similarly, if there are multiple categories or groups, it may not be recommended to use the Sankey chart as it may clutter the visual.

4. What are some alternative visualizations to Sankey charts?

Some of the alternative visualizations to Sankey charts include:

Treemaps for displaying the hierarchical data.
Flowcharts or flow diagrams for visualizing the relationship between different components.
Network diagrams for showcasing the relationship between the network nodes.
Chord diagrams for displaying the entity relationships in a circular layout.

5. Can I use Sankey charts for predictive analysis?

No, Sankey charts are useful to visualize or describe any relationship between different categories or groups by displaying a direction of flow. Hence it can’t be for doing any predictive analysis.

Download Template

This article must be helpful to understand the Sankey chart in Tableau, with its formula and examples. You can download the template here to use it instantly.

Guide to What is the Sankey chart in Tableau. We explain how to create Sankey chart with components, examples, and downloadable template. You can learn more from the following articles –

Pareto Chart in Tableau

Tableau Gantt Chart

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *