cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vmakhija Established Member
Established Member

lookup value from table with multiple values

Hello

I have 2 tables as below -

 

Table A

ID ProductCat
123 Appliances
131 Laptops
130 Mobiles
129 Appliances
128 Laptops
127 Mobiles
126 Appliances
125 Laptops
124 Mobiles

 

Table B

Category ID
Mobiles 123
Appliances 124
Laptops 124
Appliances 125
Laptops 125
Appliances 126
Mobiles 126
Laptops 127
Appliances 128
Mobiles 127
Laptops 128
Appliances 129
Mobiles 129
Laptops 130
Mobiles 130
Appliances 131
Laptops 131

 

I want to do the following - 

Create a flag column in Table A which will set value to Yes if a particular category in Table A for an ID matches with any one of categories in Table B for that ID.

Lookup won't work here as it will give error - "A table of multiple values...."

 

I tried this 

CATEGORY_FLAG =
IF(SEARCH(TableA[ProductCat],CONCATENATEX(DISTINCT(TableB[Category]),TableB[Category]),1,-1)>0,
"Yes","No")

 

But somehow I want to filter the result of concatenatex to be just for a particular ID. However, above column will always take all values of category.

 

Any thoughts?

 

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: lookup value from table with multiple values

@vmakhija

 

Try this pattern

 

=
IF (
    COUNTROWS (
        FILTER ( TableB, TableA[ID] = TableB[ID] && TableA[ProdCat] = TableB[ProdCat] )
    )
        > 0,
    "yes",
    "no"
)

View solution in original post

1 REPLY 1
Highlighted
Super User
Super User

Re: lookup value from table with multiple values

@vmakhija

 

Try this pattern

 

=
IF (
    COUNTROWS (
        FILTER ( TableB, TableA[ID] = TableB[ID] && TableA[ProdCat] = TableB[ProdCat] )
    )
        > 0,
    "yes",
    "no"
)

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 132 members 1,730 guests
Please welcome our newest community members: