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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Sem_Valks
New Member

How to create hierarchy table of tables with many-to-many relationship?

In my datamodel below I want to have a relationship from the documents table to the Employer, Employee, Assignment and Taxservice table since a document can belong to one of those tables. Creating these relationships directly is not possible because it wil create ambiguous paths. Therefore my idea was to create a hierarchy table with the Employer, Employee, Assignment and Taxservice tables in it. From there I can create a relationship between the hierarchy table and the documents table. 
However, there is a many-to-many relationship between the Assignments and TaxServices tables. 

 

Is it possible to create a hierarchy table of multiple tables if there is a many-to-many relationship between two of them? Or is there any other way of creating a relationship between the documents table and the other 4 tables without creating ambiguous paths?

Sem_Valks_0-1724397294711.png

 

4 REPLIES 4
rajendraongole1
Super User
Super User

Hi @Sem_Valks - You can create a new table, called HierarchyTable, that contains the unique identifiers from each of these tables. The HierarchyTable should have columns like DocumentID, EmployerID, EmployeeID, AssignmentID, and TaxServiceID.

HierarchyTable with the relevant keys from each of the Employer, Employee, Assignment, and TaxService tables. The table should be structured so that each row represents a unique document linked to one of these entities.

lastly as mentioned document table, you can create a relationship between the Documents table and the HierarchyTable based on the common key (e.g., DocumentID).

For many to many you can follow the below scenerio:

Create a bridge table that resolves the many-to-many relationship between Assignment and TaxService. This bridge table can have columns like AssignmentID and TaxServiceID.

 

Hope the above information helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks for your reply but this does not solve my issue entirely.

I can create the hierarchy table as you are mentioning which makes it possible to create a relationship between the documents and the parent, but in this situation I lose the relationship between the Employee, Employer, Assignment and TaxService tables. 

Can you make a schematic view of the datamodel that you are suggesting?

 

Hi @Sem_Valks - can you chehk the below model , i have used the approx column names

rajendraongole1_0-1724402877794.png

 

Hope it helps to design the same at your end.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





With the model you suggest, I cannot create the desired report.

I would like to creat this datamodel:

Sem_Valks_0-1724406495043.png

However, this is not possible due to ambiguous paths. Therefore my idea was to create a big hierarchy table with parent/child relations which includes all Employer, Employee, Assignment and TaxService data, like below:

Sem_Valks_1-1724406575313.png

But I do not know how to create this hierarchy table since there is a many-to-many relationship between the TaxService and Assignment table. This means that one TaxService can have multiple parents which causes a problem when trying to create a hierarchy table without duplicating the taxservice rows for each parent.

Is there any solution to this case?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors