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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
YingKai
New Member

DAX calculated column to find if record exist in another table with 1:many relationship

Hi, need some help here.

I have two tables, table A and B, relationship is 1:many, both and they are linked by key A[SO Doc] and B[SO Number].  Would like to created a calculated column called "Found in Table B" in Table A to show if A[SO Doc] is found in Table B.  Table B must first be filtered to remove Ticket type <> F&B or Resubmit = Yes before comparing the two tables.

Table A

SO DocBlock TypePrice
1234Food10
1235Non Food30
1236No block20
1237Food40
1238Food10

 

Table B

TicketSO NumberTicket typeResubmit
11234F&BYes
21236LogisticNo
31237F&BNo
41237F&BNo
51234F&BNo
61238F&BNo
71239F&BNo

 

Complimentary information:  After filtering table B, it should look like the following:

TicketSO NumberTicket typeResubmit
31237F&BNo
41237F&BNo
51234F&BNo
61238F&BNo
71239F&BNo

 

Finally, result in Table A should look like the below:

SO DocBlock TypePriceFound in Table B
1234Food10Found
1235Non Food30Not found
1236No block20Not found
1237Food40Found
1238Food10Found

Hope someone can help me on this.

Thank you.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Picture1.png

 

Found in Table B CC =
IF (
'Table A'[SO Doc]
IN SUMMARIZE (
FILTER (
'Table B',
NOT ( 'Table B'[Ticket type] <> "F&B"
|| 'Table B'[Resubmit] = "Yes" )
),
'Table B'[SO Number]
),
"Found",
"Not found"
)


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@YingKai can you share the expression you used? I don't get this error.



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 , I relooked and this time the error is gone.  Sorry about this.  With your help, I managed to edit the code to get to the result.  Thanks again.

Column = VAR __table = CALCULATETABLE ( RELATEDTABLE ( TableB ), Not(TableB[Ticket type] <> "F&B" || TableB[Resubmit] = "Yes" ))
RETURN IF ( NOT ISBLANK ( COUNTROWS ( __table ) ), "Found", "Not Found" ) 

 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Picture1.png

 

Found in Table B CC =
IF (
'Table A'[SO Doc]
IN SUMMARIZE (
FILTER (
'Table B',
NOT ( 'Table B'[Ticket type] <> "F&B"
|| 'Table B'[Resubmit] = "Yes" )
),
'Table B'[SO Number]
),
"Found",
"Not found"
)


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim , thank you very much for the clear precise presentation of solution.  As a young learner, I can understand the solution easily.

parry2k
Super User
Super User

@YingKai add a new column in TableA using the following DAX expression, you can change the logic as you see fit.

 

Column = 
VAR __table = CALCULATETABLE ( RELATEDTABLE ( TableB ), TableB[Ticket type] <> "F&B" || TableB[Resubmit] = "No" )
RETURN IF ( NOT ISBLANK ( COUNTROWS ( __table ) ), "Found", "Not Found" ) 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



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.

Hi Parry2k, thank you first of all.  I got error "A table of multiple values was supplied where a single value was expected."  To bring back, my table A to B is 1:many and both direction.  Can you please relook?  Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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