Learn how to make Sankey Diagram in Tableau through this amazing tutorial!
Get the dataset and workbook:
New Tableau 2018 Course, special YouTube promotion, click link below:
95% OFF — A limited time, YouTube ONLY offer!
Enroll today ==> https://www.udemy.com/tableau-2018/?couponCode=YOUTUBE95
Sankey Diagrams display flows and their quantities in proportion to one another. The width of the arrows or lines are used to show their magnitudes, so the bigger the arrow, the larger the quantity of flow. Flow arrows or lines can combine together or split through their paths on each stage of a process. Colour can be used to divide the diagram into different categories or to show the transition from one state of the process to another.
CONNECING TO THE DATA
2:02 - We'll connect the data, connect to our Excel file and we'll connect to our African mobile data Excel file.
2:15 - We'll bring in our sales data and you'll see that we have the full 1056 rows that we’re looking for.
2:41 - You have your SELECT statement, then you tell them what columns to bring in.
WORKING WITH DATA
2:57 - So what we're going to do, is we're going to take this; we're going to Union all, with the exact same data set.
3:24 - So we'll put it in segment right here, we'll call this "VizSide"
3:32 - Then over here, we're going to call this region, as "VizSide".
4:07 - So what we actually need to do, is somehow create these marks so Tableau will be able to draw the lines across them.
4:38 - I'm going to walk you through the first steps of that data densification
5:22 - So now we have ToPad, the thing is if you bring ToPad out to columns.
5:37 - But if you come down, you click on it you say create bins
6:17 - So we've basically done is used Tableaus in-memory engine, to create these extra marks
6:31 - Next, we're going to create a calculated field called T.
6:44 - What this does is a little bit of an offset, that evenly spaces all our marks across the view.
7:10 - We have a value of 1 we have our value of 49 but we also have a mark for every single individual bin. This is the essence of data densification and data padding.
7:26 - So, now we have our vertical marks, we have vertical data sets, our horizontal marks.
8:01 - Now we're going to come in and we’re going to duplicate that, and we will edit, call this Rank 2 - I'm actually going to leave it entirely the same.
8:17 - The next calculated field we need to make is our sigmoid function. The sigmoid function right here off Wikipedia mathematical function with an s-shaped curve.
8:32 - So we're going to create a sigmoid. It is going to be 1 over 1 plus; now we need to use e; Tableau doesn't have e as a function but it does have an exponent function.
8:48 - So if we do exponent 1 that's the same thing as typing e. Then we're going to raise it to the power of negative T.
BUILDING A VIEW
10:17 - Ok those a lot of different calculations and now we get to the exciting part, where we're actually going to build out our view for a little bit.
10:55 - At this point we'll need to add in the two sides of our table or the two sides of our visualization that we’re building.
11:13 - So we want it to include Segment, we want to include Region and then we want to include Padded because it tells you go from Segment to go to Region a long Padded.
11:30 - Coming up to Rank 2 we're going to use all three again, but in this case, we want it to go from Padded, sorry from Region to Segment to Padded.
11:42 – And then for T we're going to make sure that it's using Padded so that our sigmoid function is able to comprehend every single mark.
12:19 - In the same spirit we will come to our curve and make it go from 0 to 1.
12:46 - Then we can come in we can hide our headers and we have very good makings of our Sankey Chart.
13:44 - So, what we need to do rather than using sum sales itself, we're going to create another calculation. We call this a Sales Sizing and we'll use a table calculation in order to trick Tableau
15:27 - We want to come into our color scheme as well and rather than being blue orange red will make it blue orange green just so it matches our Sankey Chart.
CREATING A DASHBOARD
16:13 - Now we're going to create a dashboard that has all three of them.
16:25 - So first we're going to bring in our Sankey Chart. Then we'll add in Segment to the side and we'll add in Region to the other side.
16:40 - Then we'll do some more cosmetic stuff where we'll hide the actually don't need these titles either. As we come through we can format we can get rid of our gridlines we can get rid of our 0 lines clean that up a little
17:22 - A couple more cosmetic things we're going to do real fast. Our tool tips are really distracting at this point. So I'm going to go, I'm going to disable them on all of our charts.
18:18 - The last thing we want to add is actually some dashboard actions.