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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
o-johnralphp
Frequent Visitor

Look for Values from 2 Columns in a Separate Table

Hi Everyone,

 

I have 2 separate table (Table1 and Table2) and would like to create a calculated column on the Table1 to return the value based on Table2 2columns.

Table1
InvoiceItemsDesired Output
12345Banana apple grapes orangePackage1,Package2
123456apple orangeNo Match
123457Banana orange applePackage2

 

Table 2
PackageTypeItemAItemB
Package1grapesorange
Package 2bananaorange

 

Many thanks  for the help.

 

 

 

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @o-johnralphp 

You can do this using a calculated column in Table1 that checks both ItemA and ItemB from Table2 and returns all matching package names.

 

Calculated column (Table1):

Desired Output =
VAR txt = LOWER('Table1'[Items])
VAR match =
   ADDCOLUMNS (
       'Table2',
      "@pkg",
       IF (
          CONTAINSSTRING ( txt, LOWER('Table2'[ItemA]) ) &&
           CONTAINSSTRING ( txt, LOWER('Table2'[ItemB]) ),
          'Table2'[PackageType]
       )
   )
VAR result =
   CONCATENATEX ( FILTER ( match, [@pkg] <> BLANK() ), [@pkg], ", " )
RETURN IF ( result = BLANK(), "No Match", result )

image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
rohit1991
Super User
Super User

Hi @o-johnralphp 

You can do this using a calculated column in Table1 that checks both ItemA and ItemB from Table2 and returns all matching package names.

 

Calculated column (Table1):

Desired Output =
VAR txt = LOWER('Table1'[Items])
VAR match =
   ADDCOLUMNS (
       'Table2',
      "@pkg",
       IF (
          CONTAINSSTRING ( txt, LOWER('Table2'[ItemA]) ) &&
           CONTAINSSTRING ( txt, LOWER('Table2'[ItemB]) ),
          'Table2'[PackageType]
       )
   )
VAR result =
   CONCATENATEX ( FILTER ( match, [@pkg] <> BLANK() ), [@pkg], ", " )
RETURN IF ( result = BLANK(), "No Match", result )

image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Thank you very much!!! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.