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
LR_newbie
Frequent Visitor

Value lookup/ search of multiple values

Hello, 
I have a problem that I cannot seem to solve with DAX. I will appreciate any help from you.
I have a table my_table that contains a column with one or more employee IDs per cell, for example:

employee IDEmployee name
12; 44 
56; 33; 34 

 
I have another table called employee translation: 

IDName
12John
44Lena

now I am trying to lookup the value of the IDs and adding the respective name to the first table. for example the value of the first row in 'my_table'[employee name] should be: John; Lena
I tried the following: 

Var result=
CONCATENATEX( 'employee translation', if( search( FIRSTNONBLANK'employee translation'[ID] , TRUE()), 'my_table'[employee ID],,999) <> 999, 'employee translation'[name], ""))
return
if( result <> BLANK(), CONCATENATE(result,";"), "Not found")

but this is returning the full employee translation in case the value is found in that table. 

I would appreciate any help. 




1 ACCEPTED SOLUTION

Thanks for the replies! I ended up doing transform data before and translated each name seperatly then concatenated all names. 
This worked better for me! 
thanks 🙂

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @LR_newbie 

Thanks for reaching out to us.

>>but this is returning the full employee translation in case the value is found in that table. 

so what's the expected outcome? It has three scenarios, one is that all values can be found in that table, the other is that some of them can be found, and the third is that none of them can be found.

vxiaotang_0-1655969639546.png

 

Best Regards,

Community Support Team _Tang

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

Hello, it is returning all values meaning even the values that are not in the cell are being returned. 
for example cell one should return John; Lena. assume the employee translation table has names: John, Lena, christian and Lisa. the DAX is returning all names John; Lena; christian; Lisa and not just the names found in the cell. 
hope that clarifies

Hi @LR_newbie 

Thanks for your reply.

>> it is returning all values meaning even the values that are not in the cell are being returned. 

So your expected result is that measure only returns the name that can be found in translation. 

-

So what I am confused about is that currently this column has achieved this result. As you can see,

vxiaotang_0-1656495638952.png

For row1, Column="JohnLena;", you can optimize it like this

Column = 
Var result=
CONCATENATEX( 'employee translation', if( search( FIRSTNONBLANK( 'employee translation'[ID] , TRUE()), 'my_table'[employee ID],,999) <> 999, 'employee translation'[name],""),";")
return
if(LEN(result)>1, result, "Not found")

result

vxiaotang_1-1656495736677.png

 

Best Regards,

Community Support Team _Tang

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

Thanks for the replies! I ended up doing transform data before and translated each name seperatly then concatenated all names. 
This worked better for me! 
thanks 🙂

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.