Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
pbsamar
Regular Visitor

How do I create Sankey Chart from two table data?

We have following two tables "Shop Transaction" and "Organization Tree".

Use PowerBI desktop to create a Sankey chart using these data.

 

Note that:

  • When a shop is added or a shop changes district, the start date changes in "Organization Tree".
  • Organization Tree’ has a hierarchy of Region> District> Shop. The Region is the root of the tree.

 

Shop TransactionShop Transaction

Organization TreeOrganization Tree

 

Output Sankey data format

Output Sanky formatOutput Sanky format

1 ACCEPTED SOLUTION
mickey64
Super User
Super User

Step 0: I use these DATA Tables below. (I add some dammy data to 'Shop Transactions' table.)

mickey64_0-1721094574077.png

 

mickey64_1-1721094608290.png

 

Step 1: I add a column to these 2 tables each.

mickey64_2-1721094761495.png

 

mickey64_3-1721094858944.png

 

Step 2: I merge 2 tables.

- Before -

mickey64_4-1721095023671.png

- After -

mickey64_5-1721095107410.png

 

Step 3: I sort 'Shop Transactions' table with 'shop no' column and 'date'column.

 

Step 4: I fill down 'Parent' column.

mickey64_6-1721095326610.png

 

 

 

View solution in original post

3 REPLIES 3
mickey64
Super User
Super User

Step 0: I use these DATA Tables below. (I add some dammy data to 'Shop Transactions' table.)

mickey64_0-1721094574077.png

 

mickey64_1-1721094608290.png

 

Step 1: I add a column to these 2 tables each.

mickey64_2-1721094761495.png

 

mickey64_3-1721094858944.png

 

Step 2: I merge 2 tables.

- Before -

mickey64_4-1721095023671.png

- After -

mickey64_5-1721095107410.png

 

Step 3: I sort 'Shop Transactions' table with 'shop no' column and 'date'column.

 

Step 4: I fill down 'Parent' column.

mickey64_6-1721095326610.png

 

 

 

PhilipTreacy
Super User
Super User

Hi @pbsamar 

 

Based on your desired result, it looks like a Decomposition Tree is more what you are after rather than a Sankey Diagram?

 

Either way, there's no way to relate the Shops in the first table to the Districts.  How do you know which District the Shop1 and Shop21's belong to?

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi  @PhilipTreacy 

 

Based on 'date'  from "Shop Transactions" and 'start date' from "Organization Tree" , a  'region' column need to be

created, which should look like :

 

dateshop nochecksale amountRegion
2-Jun-24shop1110district1
3-Jun-24shop1220district1
4-Jun-24shop1330district1
5-Jun-24shop1440district2
6-Jun-24shop1550district2
7-Jun-24shop1660district2
2-Jun-24shop2110district1
4-Jun-24shop2330district1
5-Jun-24shop2440district1
6-Jun-24shop2550district1
7-Jun-24shop2660district1
2-Jun-24shop2111district2
3-Jun-24shop2122district2
4-Jun-24shop2133district2
5-Jun-24shop2144district1
6-Jun-24shop2155district1
7-Jun-24shop2166district1
3-Jun-24shop22220district2
4-Jun-24shop22330district2
5-Jun-24shop22440district2
6-Jun-24shop22550district2
7-Jun-24shop22660district2

 

 

Regards,

 

pbsamar

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.