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
Anonymous
Not applicable

How to filter multiple columns for a list of text values

I have a text search problem which I cannot find a good solution for. 

 

I have a table "Code Table"  with 5 text columns: Code 1, Code 2, Code 3, Code 4, Code 5. I want to search each of these columns for a list of 27 values in another table, "Value Table". If one of these values matches anything in the code columns then I want to create a "Results" column showing TRUE/FALSE. 

 

Important note - the results table can link to any of the code columns. I am essentially using the results table as a filter. 

 

I could do this with a nested IF statement, but that's ugly. Is there a simpler way to do this? 

 

Example of the data structure: 

 

Code 1Code 2Code 3Code 4Code 5Results

a1 b2  TRUE
b2    TRUE
  c3  TRUE
   c3 TRUE
 d4   TRUE
z26    FALSE
  y25  FALSE

 

Results

a1
b2
c3
d4
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

You can use this Custom Column.

please see the attached file's query editor as well

 

=List.ContainsAny(Record.ToList(_),ValuesTable[Results])

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

You can use this Custom Column.

please see the attached file's query editor as well

 

=List.ContainsAny(Record.ToList(_),ValuesTable[Results])

 

 


Regards
Zubair

Please try my custom visuals

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.