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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jasonwq
Helper I
Helper I

How to check if values exist in another table's column?

I have these two tables

 

Item_Purchase
A 
B 

 

Item_NoEntry_TypeQTY
ASale10
APurchase10
BSale10

 

I made a new column to change the second table into this:

_PurchFlag = if(ItemLedgerEntries[Entry_Type] = "Purchase", ItemLedgerEntries[Item_No])
 
Item_NoEntry_TypeQTY_PurchFlag
ASale10 
APurchase10A
BSale10 

 

I'd like to get the first table to look like this

Item_Purchased
ATRUE
BFALSE

 

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 1
AllisonKennedy
Super User
Super User

@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 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
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.