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
ScORE
Helper I
Helper I

Need help with looking up multiple values from an unrelated table

I need help!  I have a table with multiple values listed, seperated with commas. I need to look up the category, but it is in a seperate unrelated table.  I want it to return all of the values from the category for each item in the cell.  Ideally, I would like to have just one category returned, even if the category has two food matches.

 

Column in my table

Food
Apples, Cherries, Celery, bread
Apples, Cheese, Celery, bread

 

Desired output

Value I want from look up
Fruit, Vegetable, Grain
Fruit,Dairy, Vegetable, Grain

 

look up from this table

FoodCategory
ApplesFruit
CherriesFruit
CeleryVegetable
BreadGrain
CheeseDairy

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@ScORE,

 

Try this calculated column in MainTable (your first table):

 

Categories = 
VAR vCategories =
    FILTER ( LookupTable, CONTAINSSTRING ( MainTable[Food], LookupTable[Food] ) )
VAR vDistinctCategories =
    SUMMARIZE ( vCategories, LookupTable[Category] )
VAR vResult =
    CONCATENATEX ( vDistinctCategories, LookupTable[Category], ", " )
RETURN
    vResult

 

DataInsights_0-1710254041414.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@ScORE,

 

Try this calculated column in MainTable (your first table):

 

Categories = 
VAR vCategories =
    FILTER ( LookupTable, CONTAINSSTRING ( MainTable[Food], LookupTable[Food] ) )
VAR vDistinctCategories =
    SUMMARIZE ( vCategories, LookupTable[Category] )
VAR vResult =
    CONCATENATEX ( vDistinctCategories, LookupTable[Category], ", " )
RETURN
    vResult

 

DataInsights_0-1710254041414.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Worked Phenomonally!  Thank you!  My apologies for the delay responding, unfortunately I have to blame Spring Break 😎

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.