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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Join 2 tables with many to many relationship and compare

Hi, 

 

We have two tables A and B.  We have two requirements to achieve our report. 

 

A Table : 

Code     Production Date

100001 6/10/2020

100001 6/15/2020

100002 6/16/2020

100001 6/17/2020

100003 6/18/2020

100004 6/19/2020

 

B Table

Code   Sub Code

100001 030401

100001 005020

100002 302003

100002 422322

100002 112321

100003 543433

 

1. To join this two tables , for example, -- It's many to many relation. Not sure how to do that in DAX.

Code   Sub Code   Date

100001 030401 6/10/2020

100001 005020 6/10/2020

100001 030401 6/15/2020

100001 005020 6/15/2020

100002 302003 6/16/2020

100002 422322 6/16/2020

100002 112321 6/16/2020

..... ..... .....

 

2. To filter out the code which was not existed in Table B and show it in the multiple-row card. 

 

Would you please help me on this ? Appreciate if anyone can help 🙂

 

Thanks!

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

A:

a1.PNG

B:

a2.PNG

 

Table(a calculated table):

Table = DISTINCT(B[Code])

 

There is a many-to-many relationship between A and B. You may create a measure as below.

Visual Control = 
IF(
    NOT(SELECTEDVALUE(A[Code]) in DISTINCT('Table'[Code])),
    1,0
)

 

Finally you may put the measure in the visual level filter to filter out the code which is not existed in Table B and show it in the multiple-row card.

a3.PNG

 

Best Regards

Allan

 

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

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

 

Best Regards

Allan

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

A:

a1.PNG

B:

a2.PNG

 

Table(a calculated table):

Table = DISTINCT(B[Code])

 

There is a many-to-many relationship between A and B. You may create a measure as below.

Visual Control = 
IF(
    NOT(SELECTEDVALUE(A[Code]) in DISTINCT('Table'[Code])),
    1,0
)

 

Finally you may put the measure in the visual level filter to filter out the code which is not existed in Table B and show it in the multiple-row card.

a3.PNG

 

Best Regards

Allan

 

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

 

Anonymous
Not applicable

if you are looking for a result like this:

 

merge outer.JPG

 

then you have only to merge and expand using UI of power query

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.