In today’s blog, I will guide you through how to use sigmoid function and create an Sankey chart using Tableau. Sankey diagrams are specific type of flow diagram in which the width of the arrows is shown proportionally to the flow quantity. Sankey diagram put a visual emphasis on the major transfers or flows within a system.

Below is the illustration of how sankey diagram looks:

This chart has 3 components:

1- Country on left side in stack bar format

2- Flow diagram in center showing the flow

3- Players name on the right side in stack bar

This graph shows depicts the Cricket players and the country where they belong.

Below is the final output of my Sankey chart using Tableau:

Since we have fair idea of Sankey diagram and what it shows lets get going and learn how to make one:

Step 1:

In our example we will consider top 20 ranked ICC cricketers for One day internationals for 2016 and 2017. Import the excel file into Tableau (Below screenshot of data)

Step 2:

Once data is imported we need to define the number of points to draw a smooth sigmoid curve. We will now create a calculated field “Point” and assign 1 for 2016 records and 49 for 2017 records:

Step 3:

For sigmoid curve, the coordinate values should be in between -6 and +6. To generate that curve we will create following calculated fields which we will use to create the curve:

Index = index()

X = 0.25*[Index]-6.25

Sigmoid = 1/(1+EXP(-[X]))

Curve = WINDOW_MIN(IF FIRST()=0 THEN MIN([Rank]) END)+[Sigmoid]*[Change]

Step 4:

Next is to create a bins (padded) based on Point. This will create additional 47 points which we need to create the curve through data densification

Step 5:

Drag Padded into rows and right click –> select show missing values then drag padded to details and then drag index into details as well and make it compute using Padded and similarly drag X into columns and curve into Rows in the sheet then make them compute using padded for both X & Curve as shown in below screen shot:

After bit of formatting, the chart will look like this with sigmoid curve with 2016 vs 2017 rankings of top 20 ODI batsmen:

 

Our sigmoid curve for Sankey graph is ready. Now, our next step should be to create one worksheet with all the countries and other stack bar with names of the players. Then we can add all sheets in dashboard to get desired Sankey flow chart output.

you can find tableau workbook here

Thanks!!

Do subscribe to blog for getting regular updates 🙂

 

I have been thinking about starting a blog from long time however I didn’t get time to start one. Here I am now starting one. Today we are going to see the data visualization on Tableau with Statistics of Virat Kohli. Cricket has been one sport that I have been following since early childhood. So I thought why not pick cricket as topic for my first blog.

Here is the steps I took to download:

1 – Download the data from espncricinfo.com and pasted data into excel spreadsheet

2 – Import the excel into Tableau

3 – Visualize the data into Tableau

4 – Publish the data into Tableau Public and below is the output produced: