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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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