cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sachy123
Helper V
Helper V

Hierarchy Modelling - Many to Many relationships

In my operational database, the tables are structured in such a way that each object has its own ID and the relationship between objects are stored in another tabes called as relation tabe.

Essentially, the relation table contained a parent child relationship. I added an extra column in it called as PATH, that I can use to traverse through the relations. 

So the tables are City, State, Country and Continent.

City:

Sachy123_0-1667551740660.png

State

Sachy123_1-1667552039665.png

 

Country 

Sachy123_2-1667552051594.png

 

Continent:

 

Sachy123_3-1667552064169.png

 

 

Most Important is this table which shows the path

table_REL

 

Sachy123_4-1667552094045.png

 

 

Question : What is the best way to model this kind of structure in Power BI?  

The below obviously doesnt work the best.

Sachy123_5-1667552549559.png

 

Shall I make a bridge table and then link the Table_Rel to each dimension? Has anyone come across such modelling ?

 

 

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Sachy123 ,

The bridging table approach is considered the best practice when relating two dimensions. 
Many-to-many relationship guidance

You can rebuild the metadata of the table in PQ to create a snowflake model:

Continent(1)(Continent_ID) --> (*)Country(1)(Country_ID) --> (*)State(1)(State_ID) -->(*)City 

Understand star schema and the importance for Power BI

Parsing Organizational Hierarchy or Chart of Accounts in Power BI with Parent-child Functions in DAX

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors