Forum Discussion
How to check if values exist in another table's column?
I have these two tables
| Item | _Purchase |
| A | |
| B |
| Item_No | Entry_Type | QTY |
| A | Sale | 10 |
| A | Purchase | 10 |
| B | Sale | 10 |
I made a new column to change the second table into this:
| Item_No | Entry_Type | QTY | _PurchFlag |
| A | Sale | 10 | |
| A | Purchase | 10 | A |
| B | Sale | 10 |
I'd like to get the first table to look like this
| Item | _Purchased |
| A | TRUE |
| B | FALSE |
I want to ask the Table,
Which ITEMS exist in the _PurchFlag field?
and for every item that exists in the field, change it to TRUE in the other table.
1 Reply
- AllisonKennedy
Community Champion
jasonwq This looks like it might run into circular reference errors at some stage. Do you have a DimItem table? If you do, use that in a table visual in Power BI and you should be able to easily combine the two tables with measures rather than columns. What else is in the first table? Is Item unique in the first table? It looks to me like _Purchase should be a MEASURE:
_Purchase = IF( COUNTROWS ( FILTER ( Table2, Table2[Entry] = "Purchase") > 1, TRUE, FALSE)
https://excelwithallison.blogspot.com/2020/08/its-complicated-relationships-in-power_11.html