Sankey Diagram shows the flow in the relationship between two different elements. I made Sankey Diagram in Tableau using Sample Superstore Dataset to show the flow of Sales between two different dimensions Segment and Region. You can also go through a blog written by Chris Love for understanding how to make the visually appealing Sankey chart in Tableau. We need to follow the following steps to get the chart-

1. First, union the order data table to itself to get the Table Name Column.


2. Then we need to create a calculated field ToPad and create bins from it of size 1 which helps in data densification.


3. Next, create another calculated Field t. Drag ToPad(bins) to detail and T calculated field to Column pill. Calculate t using To Pad (bins). This helps to spread evenly all the marks on the view.



4. Next, we create the calculated field Rank. This helps to form the start position and to set the end position we duplicate this calculated field and rename it as Rank 2.


5. Then create another calculated field to create a sigmoid function to create curve shape in Sankey flow.


6. Next, we create a calculated field Curve which builds the curve from Rank to Rank 2.


7. Drag Curve calculated field to Rows pill and nested edit table calculations for Rank to order from Segment to Region to To Pad (bins).


8. For Rank 2 set order for specific dimensions from Region to Segment to To Pad(bins). For t set specific dimensions to To Pad(bins).


9. Edit x-axis to be fixed from -5 to 5 and y-axis to be fixed from 0 to 1 to create the view properly.

10. Edit y-axis to be reversed to get alphabetic order of segments and hide the headers.


11. Change graph type to line and Drag To Pad(bins) to Path.

12. Create calculated field Sales Sizing. This will size the lines by sales. Drag Sales sizing calculated field to size shelf and compute it using To Pad(bins).


13. Change Segment detail to colour and Region detail also to colour to help colour the lines.


14. Create two more sheets for segment and region for creating the labels on the dashboard.

15. Drag all the three sheets on the dashboard and give a suitable title. Set Hover actions from labels sheet to Sankey sheet.

The Data School
Author: The Data School