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
souchock
Regular Visitor

How to arrange data to eliminate many to many relationship

I am trying to setup data tables properly to eliminate a possible many-many relationship.
I have Test Types, which each have a Test Length. 

Each Test Type affects certain Components.

Each Component has a Due Date.

 

I have a many-many relationship between Test Type and Components.

Like this: Relationship.png

 

So my data tables are currently arranged like this:

DataTables.png

I can re-arrange the tables to look like this, but then I don't have a common column to connect:

DataTables2.png

Is there a best-practice or other method to setup my data tables to properly manage these relationships?

 

 
2 ACCEPTED SOLUTIONS
v-xicai
Community Support
Community Support

Hi @souchock ,

 

For the left table in your 3rd picture above, you may enter into Query Editor, select on the column Component1, Component2 and Component3 at the same time, right click to choose option "Unpivot columns", then you can rename the result  columns with "Affected Component" and "Is Affected". Don't forget to click button "Apply & Close" .

 

Then you can create relationship with the right table in picture on field [Affected Component] in "Both" Cross filter direction.

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Ok then i am unsure of what you asking, does your current relationship give you what you need or what are you missing?  Are any of these transactional data or is all just lookup data, if its all just look up data, the best thing to do in my opinion is just denormalise into one table, so in power query merge the 3 the tables together.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
v-xicai
Community Support
Community Support

Hi @souchock ,

 

For the left table in your 3rd picture above, you may enter into Query Editor, select on the column Component1, Component2 and Component3 at the same time, right click to choose option "Unpivot columns", then you can rename the result  columns with "Affected Component" and "Is Affected". Don't forget to click button "Apply & Close" .

 

Then you can create relationship with the right table in picture on field [Affected Component] in "Both" Cross filter direction.

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

vanessafvg
Super User
Super User

It is good practise to set up a look up tables.  A date table, a component table, test table, so just the unique values of those columns in separate tables, then link all those tables to the relevant look up table, using the look up table on your visuals to slice by. You can usually avoid many to many relationship but setting up lookups and linking those in a one to many to the transactional data





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




All 3 of these are our lookup tables. They are all fixed relationships (even the Test vs Components table).

Ok then i am unsure of what you asking, does your current relationship give you what you need or what are you missing?  Are any of these transactional data or is all just lookup data, if its all just look up data, the best thing to do in my opinion is just denormalise into one table, so in power query merge the 3 the tables together.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.