Using a Sankey diagram

Contents[Hide]

1. Overview

The Sankey diagram displays how quantities are distributed among items between two or more stages.

2. Add a Sankey diagram

Choose the Data Visualization or Re-Visualize option from the toolbar and select Sankey Diagram.

Select Sankey Diagram
Select Sankey Diagram

Drag one or more columns of data or hierarchy levels to Rows in the Data Analysis Panel. Each hierarchy (e.g., non-numeric data) will be displayed as another level or stage in the diagram if you select multiple hierarchies, or you can also select multiple levels of a hierarchy that contains multiple levels.

In our example, we have selected a multi-level hierarchy. To visualize multiple levels of a hierarchy at once, click to edit it in the Data Analysis Panel and set the Top Level and Level to a range of levels, or drag a lower level from under the hierarchy in the Explore window.

Set the Top Level to be different from the Level
Set the Top Level to be different from the Level

The diagram is displayed in a river-like arrangement based on the hierarchies and their levels. Each value in the hierarchy is displayed as a rectangle called a "node".

River-like arrangement of Sankey diagram
River-like arrangement of Sankey diagram

An essential part of a Sankey diagram is a measure that determines the widths of the links between each node. Drag a measure (numeric data) to Measures in the Data Analysis Panel to visualize its quantities flowing between the items.

Flow of quantities visualized
Flow of quantities visualized

2.1. Display custom flow

If your data has information about quantities transferring between pairs of items, the Sankey diagram can assemble these into the correct structure and visualize them according to the connections in your data instead of displaying a hierarchical structure.

The Data Analysis Panel's Visualization tab for a Sankey diagram allows you set up a custom flow based on your data as shown in the figure below. By default, the hierarchies you add to the metric set are assigned under Source Name.

Move or remove all of these except the column(s) identifying the source, and add the data identifying each target under Target Name to display the custom flow between each source-target pair. Your measure should be assigned under Width.

Custom flow displayed by assigning Target Name
Custom flow displayed by assigning Target Name

The Sankey diagram example pictured above is based on a dataset containing a column coincidentally named Source, a column named Target, and a measure named Consumption, where each row describes a single connection between a pair of nodes and the corresponding quantity moving between them.

The following image shows the rows of data that specify these connections as seen when expanding the Data Preview window:

Data Preview showing the source-target pairs that make up the diagram
Data Preview showing the source-target pairs that make up the diagram

2.2. Adding a second metric set

When setting up a custom flow as described above, note that the dataset contains source-target pairs describing the links in the diagram between pairs of nodes. If you want to customize or display further information about each individual node based on your data, you will need a second metric set providing a row of information describing each node rather than each pair of nodes.

Note
When not using source-target pairs to display a custom flow, all the settings can be configured on the same metric set and you will not be able to add a second metric set to the Data Analysis Panel.

To add a second metric set, the Sankey diagram will need to be added to a dashboard or other view. If you are currently editing a metric set full screen, you can click Add To New Dashboard in the toolbar to switch to one easily.

In the Data Analysis Panel's Metric Set tab, click the + button.

Add a new metric set
Add a new metric set

Drag data corresponding with the names already used as sources and targets onto Rows. You can then add additional data to use in tooltips, for colors, or other visualization options in the Visualization tab. (If you already have another metric set containing this data, you can also drag the entire metric set onto the Sankey diagram.)

In the Visualization tab, the options for this second metric set are labeled as Nodes whereas the first metric set's options are labeled Links. Your column identifying nodes should be assigned under Name and should match the values used as link sources and targets.

Visualization tab for the nodes metric set
Visualization tab for the nodes metric set

To display the links in different colors according to data, assign it under Color in the Data Analysis Panel's Visualization tab in the Links section.

Assign a measure under Color
Assign a measure under Color

One or more color rules are applied to the links in the diagram. You can modify the the color rules by clicking the brush icon next to Color, or by going to the Look tab of the Properties window. These settings work the same way as in other visualizations, such as charts.

To change what measure is used to determine the widths of the links, remove the measure assigned under Width in the Links section if there is one and add the measure of your choice.

Assign a measure to Width
Assign a measure to Width

4. Change node color

To display the nodes in different colors according to data, assign it under Color in the Data Analysis Panel's Visualization tab in the Nodes section.

Add a measure under Color for nodes
Add a measure under Color for nodes

As with the links, one or more color rules are applied to the nodes in the diagram, and can be customized in the Properties window.

5. Change labels and tooltips

In the Text tab of the Properties window, you can customize the Label Text and Tooltip Text properties for both the links and the nodes.

These properties accept regular text, as well as keywords such as [Member] and [Level] for the hierarchy member and level captions, respectively. For additional information about available keywords, refer to the Formatting text article.

As a shortcut for applying the proper keyword, you can use the Visualization tab in the Data Analysis Panel. For example, assign data under Label in either the Nodes or Links section to display it as a label over each node or link.

Add a measure under Label for links
Add a measure under Label for links

Click the brush icon next to the Label heading to open the relevant properties. The keyword (e.g., [OrderQty]) has already been added to the Text property. 

Adjust the link labels
Adjust the link labels

6. See also

Dundas Data Visualization, Inc.
500-250 Ferrand Drive
Toronto, ON, Canada
M3C 3G8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours:
Phone: 9am-6pm, ET, Mon-Fri
Email: 7am-6pm, ET, Mon-Fri