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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Search for text from one table column in another table column and return a different column if found

I have seen some questions similar to this and I have tried some but they don't return what I want.

 

I have one table that has a column with a program name. I have a second table that has a text field that contains one or more program names (separated by commas). I want for each record in table #1 to add a new column that if I can find the same program name in table #2 and to make this new column contain the value of a totally different column in table #2. 

 

These tables both have a lot of other columns in them but I am only showing the ones I want for this task. The tables are not linked/associated to each other.

 

Table #1

Program Name

 

Table #2

Assigned programs - one column with 1 or more program names in it each separated by a comma

LOB

 

The new column should be the first found result.

 

Example data/result:

Table #1

Program NameFound LOB (new column)
GoogleLOB1
NetflixLOB2
FacebookLOB1
TwitterNone

 

Table #2 (the same LOB could be assigned to more than one combination)

Assigned ProgramsLOB
Google, FacebookLOB1
FacebookLOB3
Netflix, GoogleLOB2
Netflix, FacebookLOB2

 

I am not sure if this should be done in DAX or the Power Query (transformation) - not sure if it matters or which is better. I have tried some examples I have seen for both ways but those examples didn't fully work to bring back a value from a totally different column (some returned the searched word, or starting position, etc.). I tried the fuzzy search with merged queries but that didn't bring back just the LOB column value but inserted a table with a new column in it which isn't what I would like. I need this new column to be available for vizualizations with other columns from Table #1 (not shown). 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , A new column in table 1

 

maxx(filter( Table2, search(Table1[Program Name], Table2[Assigned Program],,0) >0 ),Table2[LOB])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , A new column in table 1

 

maxx(filter( Table2, search(Table1[Program Name], Table2[Assigned Program],,0) >0 ),Table2[LOB])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks!  If there are no records found by the Filer, will it give an error or is there a way to make it put 'None' in?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.