Tuesday, January 7, 2020

Creating a Multi-Stage Sankey Chart via Template Cascading

Since I published the basic 2-stage Sankey chart template, five of my colleagues with rudimentary Tableau skills created Sankey charts for their respective projects using the template. Their charts were so good which went beyond my wildest imaginations.

Following the publication of the template, many asked me how to create a 3-stage one. Here comes the tutorial. It's still based on the same template, just using it twice. Then cascade the two basic Sankey charts. This approach allows us to build Sankey chart of any number of stages. We will use 3-stage Sankey as an example.

Let's start it. Say, we want to create a Sankey chart on Sales from Category to Region to Subcategory. This may appear nonsense. It's just an example.

1.Create a Sankey chart on Sales from Category to Region
-- Open the template and add the Superstore data source
-- Union the data table with itself.
-- Note that we can rename Source by Category and Target by Region in the template. And rename Size as Sales.
-- Replace data source and you are done.

2.Create a Sankey chart on Sales from Region to Subcategory (in a new workbook)
-- Similar steps to the above.
-- Note that we can rename Source by Region and Target by Subcategory in the template. And rename Size as Sales.

3.Cascade the two Sankey charts
-- Copy the worksheets such as Curve, Bar2, Label2 and paste them to the first workbook.
-- Right click the tabs of the sheets to copy, and to paste.
-- Add them to the right of the first Sankey chart in the dashboard composer.

Note that the coloring is changed in the first workbook to be by Target instead of by Source. Just to make the colors more uniform in both charts.

Voila here is the workbook for download. Leave comments if you have questions. This tutorial is based on an earlier one. You need to practice that first.

This doesn't limit itself to 3 stages. You can create as many stages as you wish. Enjoy Sankey!

Also we would love to see what you come up with if you create a public viz based on the template. Leave the link to the viz in comment area.

Sankey Chart Series in Tableau
5.A Template Approach to 3-Stage Sankey Chart
3.Creating Sankey Chart with Grouping
2.Creating Multi-Stage Sankey Chart via Template Cascading
1.Creating Sankey Chart Made Easy via Template

13 comments:

  1. can we make 3-stage sankey chart with different weighted value; such as amount of sold items and sum of sales?

    ReplyDelete
  2. Might you be able to create a sankey chart that has different types of curves besides sigmoid like sine or cubic?

    ReplyDelete
    Replies
    1. Yes. You can replace Sigmoid by Sine or Cubic function.

      Delete
    2. I tried on your templated and was not able to do it. Might you give an example please?

      Delete
    3. How can you replace Sigmoid with Sine function?

      Delete
  3. Thank you very much. I just made a figure with your template. While, how to realize the corresponding relationship between the first column and the third column in the template? For example, I want to "table" is just belong to "furniture". Am I clear? Thanks a lot.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. We can't deduce 1-3 relationship from the above chart directly. You need to create a specific chart between the two.

      Delete
  4. When I try to replace datasources after renaming the source, target, and size I get errors for the Path(bin) calculated field and can't make it work. Any recommendations? Thanks!

    ReplyDelete
    Replies
    1. Did you union the data source with itself? https://vizdiff.blogspot.com/2018/12/creating-sankey-chart-as-easy-as-1-2-3.html

      Delete
    2. Yes! I should have read deeper and found the portion about SQL needing [Table Name].

      Delete
  5. hi

    Using your 3-level folders, I was able to definitely implement a raw chart, so first of all thank you.

    Here, I'd like to move on to steps 4 and 5, so could you please explain further?

    You already mentioned in your post "This is not limited to 3 steps, you can create as many as you want" but I don't know how.

    ReplyDelete
    Replies
    1. You can remove 1 stage from the template to make a two-stage template. Then you can use it to create 4th and 5th stages.

      Delete