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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Merging two unrelated tables conditionally

Hi guys,

 

I currently have two tables that haven't got any fields in common, as follows.

 

Product IDProduct
123Item A
234Item B

 

Sales IDProduct Description
45678Description [Item A] Description
56798Description [Item B] Description

 

 

I want to be able to join in the products from table 1 based on the product description on table 2, but not sure how to merge the two tables conditionally based on whether the product description contains the product name. I want to add the product ID and product name to the matched row on the second table.

 

Hope this makes sense?

 

Thanks in advance!

1 ACCEPTED SOLUTION

@Anonymous - Then use FIND, SEARCH or CONTAINSSTRING, maybe like:

 

Column = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table1',
      "Found",IF(FIND([search],[description],,0)>0,[search],BLANK())
    )
RETURN
  MAXX(FILTER(__Table,NOT(ISBLANK([Found]))),[Found])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Try Power Query fuzzy matching with Merge queries. I also invented a fuzzy matching calculation in DAX. https://community.powerbi.com/t5/Quick-Measures-Gallery/Fuzzy/td-p/1352914

 

Attached latest PBIX for convenience. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I cannot rely on fuzzy match, I need to know that the data is matching accurately. There will be a lot of free text in the description column and it will lead to incorrect matches. 

@Anonymous - Then use FIND, SEARCH or CONTAINSSTRING, maybe like:

 

Column = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table1',
      "Found",IF(FIND([search],[description],,0)>0,[search],BLANK())
    )
RETURN
  MAXX(FILTER(__Table,NOT(ISBLANK([Found]))),[Found])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

but the tables aren't related so it's not letting me look one up in the other and join it on?

@Anonymous, sorry, hit the button accidentally check updated post above, create that column in Table2 with description field.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

No worries, thank you it worked!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors