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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
smpa01
Super User
Super User

Lookup based on partial value in power query

Hi,
I have the following data

NAME ID Partial Name
SAM JONES 123 SAM
TOM CLIFF 234 TOM

If I want to bring the ID based on the partial value of I can do the following in excel and it would bring the ID based o the partial value

NAME ID Partial Name Partial Name2
SAM JONES 123 SAM *SAM*
TOM CLIFF 234 TOM *TOM*

Index(B1:B3,Match(D2,A1:A3,0))

I was wondering if Power Query has the similar capacities.

Thank you in advance.
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @smpa01,

 

If I understand you correctly, a simple DAX formula could do that.

 

I assume you have a table called "Table1" with NAME and ID column.

 

t1.PNG

 

And another table called "Table2" with Partial Name column.

 

t2.PNG

 

Then you should be able to use the formula below to create a calculate column in "Table2" to get ID from "Table1" based on the value of Partial Name. Smiley Happy

Column = 
CALCULATE (
    MAX ( Table1[ID] ),
    FILTER ( Table1, SEARCH ( Table2[Partial Name], Table1[NAME],, 0 ) > 0 )
)

c1.PNG

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Employee
Employee

Hi @smpa01,

 

If I understand you correctly, a simple DAX formula could do that.

 

I assume you have a table called "Table1" with NAME and ID column.

 

t1.PNG

 

And another table called "Table2" with Partial Name column.

 

t2.PNG

 

Then you should be able to use the formula below to create a calculate column in "Table2" to get ID from "Table1" based on the value of Partial Name. Smiley Happy

Column = 
CALCULATE (
    MAX ( Table1[ID] ),
    FILTER ( Table1, SEARCH ( Table2[Partial Name], Table1[NAME],, 0 ) > 0 )
)

c1.PNG

 

Regards

@v-ljerr-msftthanks for the solution. Is there a way to achieve this in Power Query by any chance - searching a column of Partial Text Strings in another list of column containing Text Strings.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

NAME -------------ID----------Partial Name
SAM JONES----123--------SAM
TOM CLIFF------234--------TOM

NAME------------ID---Partial Name------Partial Name2
SAM JONES-------123------SAM-------*SAM*
TOM CLIFF---------234-------TOM-------*TOM*
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.