Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 Doc | Block Type | Price |
1234 | Food | 10 |
1235 | Non Food | 30 |
1236 | No block | 20 |
1237 | Food | 40 |
1238 | Food | 10 |
Table B
Ticket | SO Number | Ticket type | Resubmit |
1 | 1234 | F&B | Yes |
2 | 1236 | Logistic | No |
3 | 1237 | F&B | No |
4 | 1237 | F&B | No |
5 | 1234 | F&B | No |
6 | 1238 | F&B | No |
7 | 1239 | F&B | No |
Complimentary information: After filtering table B, it should look like the following:
Ticket | SO Number | Ticket type | Resubmit |
3 | 1237 | F&B | No |
4 | 1237 | F&B | No |
5 | 1234 | F&B | No |
6 | 1238 | F&B | No |
7 | 1239 | F&B | No |
Finally, result in Table A should look like the below:
SO Doc | Block Type | Price | Found in Table B |
1234 | Food | 10 | Found |
1235 | Non Food | 30 | Not found |
1236 | No block | 20 | Not found |
1237 | Food | 40 | Found |
1238 | Food | 10 | Found |
Hope someone can help me on this.
Thank you.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a calculated column.
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"
)
@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" )
Hi,
Please check the below picture and the attached pbix file.
It is for creating a calculated column.
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"
)
@Jihwan_Kim , thank you very much for the clear precise presentation of solution. As a young learner, I can understand the solution easily.
@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" )
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.
User | Count |
---|---|
75 | |
75 | |
45 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |