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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
newpbiuser01
Helper V
Helper V

Flag Matching Rows in Different Tables

Hello,

 

I am trying to flag rows with matching values in two different tables. As an example, I have two tables, Table1 with a list of items, and some reference data tied to the items. Table2 is a smaller table with only 1 column and just has a list of items. The goal is to go through Table1 and flag any items found in Table2. I can't do this in a calculated column because I'll be using the userprincipalname() function to filter items by Shopper in my table.  Is it possible to do it in a measure? Since these tables don't have the same number of columns, I can't use the intersect function so I'm at a loss as to how to implement it. 

 

Table1: 

CategoryItemPriceQuantityShopper
FruitApple21A
FruitOrange31B
FruitPear51C
VegetableSpinach101A
VegetableTomato62V
Office SuppliesPen51C
Office SuppliesMarkers21E
Household SuppliesPape Towel201D
Household SuppliesDetergent31G

 

Table2: 

Item
Apple
Orange
Pear
Spinach

 

Desired Result: 

CategoryTypePriceQuantityResult
FruitApple21Yes
FruitOrange31Yes
FruitPear51 
VegetableSpinach101Yes
VegetableTomato62 
Office SuppliesPen51 
Office SuppliesMarkers21 
Household SuppliesPape Towel201 
Household SuppliesDetergent31 

 

Would anyone know how I could implement this? I'd really appreciate any help. 

 

Thank you. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @newpbiuser01 ,

 

You can create a measure.

Result = IF(MAX('Table1'[Item]) in VALUES('Table2'[Item]), "Yes", BLANK())

vtangjiemsft_0-1693274103887.png

 

Best Regards,

Neeko Tang

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

4 REPLIES 4
amitchandak
Super User
Super User

@newpbiuser01 , You can add a new column in Table1

 

New col =

Var _cnt = countx(filter(Table2, Table1[Item] = Table2[Item]), Table2[Item])

return

if(isblank(_cnt), blank(), "Yes")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

 

Would you know if/how I could implement this as a measure? The reason I ask is, the goal is to make this "filterable" by the Shopper - which in my dataset is derived from the user() function. Unfortunately, I can't use that function in a calculated column. 

 

Thank you!

Anonymous
Not applicable

Hi @newpbiuser01 ,

 

You can create a measure.

Result = IF(MAX('Table1'[Item]) in VALUES('Table2'[Item]), "Yes", BLANK())

vtangjiemsft_0-1693274103887.png

 

Best Regards,

Neeko Tang

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

Thank you @Anonymous!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.