Sankey diagram for visualization of flows

19.06.2020
A chart is always clearer than a table. But when you need to display a lot of data as a whole or to show a nested structure and interrelatedness, the columns on a regular chart turn into an incomprehensible uneven fence.

In such cases, non-standard visualization can be helpful. There are more than a hundred creative charts that cause a "wow" effect primarily due to the originality of their form. But it is not always clear what data they are appropriate for and how to create them. Today I will talk about one such chart - the Sankey chart.

It is a diagram for illustrating business processes. Sankey depicts the key steps, the intensity of flow in each section. The lines can conjoin or furcate. The width of the lines is directly related to the flow share: the larger the parameter, the thicker the line. Things that are linked are called nodes, and connections are called links.
Example of Sankey application. Sankey flow chart

What the Sankey is used for and when

This chart dates back to 1898. Its creator, Matthew H. Sankey, thus showed a comparison of a steam engine and an engine without energy loss.
History of Sankey diagram
Get my book and discover dashboard insights for free
* By clicking the button you agree to the privacy policy
Nowadays Sankei is used not only in industry, but also in web analytics, financial and technical fields. It can illustrate clearly any kind of business processes and flow movements. The Sankey diagram shows the load, throughput, efficiency, interconnections and their strengths and a specific contribution to the overall flow.
An example of Sankey flow chart for displaying data in sports
Sankei shows:

• energy or fuel movement (clearly showing electricity distribution, heat transfer process, fuel losses demonstration, etc.);
• cash flow;
• demographic flows;
• population migration;
• world ratings;
• mining volumes;
• disease statistics;
• budget allocation;
• visitor flow and traffic source;
• movement of teams in sports competitions.

For example, sankey diagrams are used annually to illustrate the distribution of the budget in different countries:
An example of Sankey diagram for displaying RF federal budget data

How to prepare data and create a Sankey chart in Power BI

There are no ready-made chart templates in Microsoft Office and its likes. I had seen the work of an enthusiast who managed to create a Sankey based on a dotted diagram with connecting lines. This required almost 30 auxiliary data series. Believe me, it's not worth it. It is much faster and easier to choose a special tool for this purpose. We will analyze the option of creating by using the MS Power BI application.

Preparing data

The chart itself is constructed quickly, in two clicks. But first you need to correctly formulate the source data. In our case, this is the income and expenses budget. The usual format of the table looks like this: two types of sources (expenses or proceeds), grouping items by category, numeric values.
Preparation of raw data for drawing a Sankey diagram
But one cannot construct a chart in a BI system (Tableau or Qlik) based on such a table. One needs to make it "flat" and separate sources, categories, and items into separate columns.
Data preprocessing for drawing a Sankey diagram
Still, this is not enough to construct a Sankey. In Power BI, this chart has only two parameters: the initial value (source) and the final value (destination). Now we must calculate the subtotals and move the categories from the column to the rows.

Keep in mind that the flow in the chart will go from left to right, from proceeds to expenditures. Therefore, in expenses, we put categories in the left column, and items in the right column. Here's what we got:
The final table for drawing a Sankey chart
When we upload a data sheet to Power BI, the program will want to add a column with comments. But this is unnecessary. We will load an already formatted table and Power BI will also recognize it.
Sankey set-up in Power BI
Constructing a chart

We load a custom visual element - the downloaded Sankey extension from the Appsource portal (if you try to import it from storage, you won't find it there, because this is still raw version 0). Add to the sheet, mark the fields: source in destination, article in source, and the sum in weight. Not all flows intersect conveniently, so we'll manually adjust the chart. For example, loans should not go through revenue, so move them. This is done quickly and easily. We raise advertising, shift salaries, rents, purchase of raw materials, and other flows. And so, everything became clear.
Drawing a Sankey diagram in Power BI
There aren't many opportunities to configure formatting. You can only change the color of the flows (the links parameter) and make them in the same tone with the categories. As a result, we see from which budgets and in what proportion the total cost of wages is formed. And when you point the mouse, a hint with an absolute value appears.

The Sankey diagram clearly shows interesting interconnections, a phased change in data flow. It makes explicit what is inconspicuous in tables or other standard charts. Yes, building it is not easy. There are no ready-made office templates, and embedded visualization in Power BI is limited. But this is a free product that does not require programming skills from you.

So do not fear learning new charts and tools for constructing them. It only seems like they are for designers or programmers. Advanced visualization can be any manager's communication tool.
* By clicking the button you agree to the privacy policy
You'll find simple and precise rules for creating great dashboards in my book «Dashboards for TOP-Managers». We'll send you a free copy of it via email
Get my book and discover dashboard insights for free
+995 557 525 549
Georgia, Batumi, Ximshiashvili 7
We encourage you to review and to agree to our Privacy Policy, Cookie Policy and Terms.