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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Betty888
Helper II
Helper II

Checking all items from a list are found in a comma separated text column

Dear all,

I have an issue with a query that I’m using to check whether all items from two lists are found in two text columns with comma separated. Here are few explanation :

I have a column “Code” concatenating product codes comma separated, and a second column “Type” concatenating product types comma separated also . My objective is to check that 2 specific codes AND 2 specific types are found in these 2 columns as here below :

 

Code

Type

found

A,B

ProductA,ProductB, ProductD

Ok

A,B,C,D

ProductR,ProducG, ProductF

No

C,D,E,F

ProductA,ProductB, ProductD

No

 

For that, I’m using the query below :

= each if List.AllTrue(List.Transform({"A","B"}, (substring) => Text.Contains ([Code] , substring, Comparer.OrdinalIgnoreCase))) = true  and List.AllTrue(List.Transform({"ProductA","ProductB"}, (substring) => Text.Contains ([Type] , substring, Comparer.OrdinalIgnoreCase))) = true then  "Ok" else "No"

 

But it seems not working properly as it’s not considering the comma separator, I’m saying that because cases where Code = “AB” returns an OK which makes me thinking that the comma separator is not taken into account in my query.

Thanks a lot for your help !

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Betty888 - Modified Power Query code to ensure the comma separator is properly considered

= each let
CodeList = Text.Split([Code], ","),
TypeList = Text.Split([Type], ","),
CodesFound = List.AllTrue(List.Transform({"A","B"}, (substring) => List.Contains(CodeList, substring))),
TypesFound = List.AllTrue(List.Transform({"ProductA","ProductB"}, (substring) => List.Contains(TypeList, substring)))
in
if CodesFound and TypesFound then "Ok" else "No"

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @Betty888 - Modified Power Query code to ensure the comma separator is properly considered

= each let
CodeList = Text.Split([Code], ","),
TypeList = Text.Split([Type], ","),
CodesFound = List.AllTrue(List.Transform({"A","B"}, (substring) => List.Contains(CodeList, substring))),
TypesFound = List.AllTrue(List.Transform({"ProductA","ProductB"}, (substring) => List.Contains(TypeList, substring)))
in
if CodesFound and TypesFound then "Ok" else "No"

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors