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
malex30
Frequent Visitor

How do I create a relationship between two tables with the three matching columns. (1 to 2 ratio)

I have two tables I want to connect.
1. 'Audit - HSE'

2. 'Contact'

 

the 'Contact' has a column [id]

the 'Audit - HSE' has two columns 'Contact'[id] can connect to i.e. [Supervisor, Day] and [Supervisor, Night]

 

I want to be able to connect these two tables and show the rows as a table visual. The results should show both the rows that the 'Contact'[id] matches either column.

The end result I want to perform is be able to make calculations and show tables and graphs from the results in filtering 'Contact'

For some reason I feel like I might be overthinking the solution. However, I would also like to be able determine if the 'Contact'
was either the Day or Night supervisor. (This is not as important)

malex30_0-1697228545739.pngmalex30_1-1697228587508.png

 



@amitchandak @parry2k @Ritaf1983 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@malex30 select all other columns except these two and then unpivot other columns.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@malex30 select all other columns except these two and then unpivot other columns.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@malex30 what you need to do is unpivot the audit table, select all the columns except the day, and night columns, right-click, and unpivot other columns. You will get two columns, attribute and value. Rename attribute to Shift and Value to Id. close and apply.

 

Now you have one relationship with the Contact table, visualize the way you want and if you want, you can filter on the Shift column to get only day or night.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

This is what I did. @parry2k 

malex30_1-1697473676630.png

Result:

malex30_0-1697473610444.png

 

Is this what your meant? I'm a little confused on If I did this correctly and how this works?

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.