Forum Discussion
Power Query Text.Contains function to return true when there is a "like" value
- 4 years ago
Try this PurdieB
#"Added Custom" = Table.AddColumn( #"Trimmed Text", "Custom", each try List.Count( List.Intersect( { List.Transform(Text.Split([Requirement 1], ","), Text.Trim), List.Transform(Text.Split([Held Accomps], "&"), Text.Trim) } ) )>0 otherwise falseYou have to parse the values out into lists (the first uses & as a delimiter, the second uses a comma) then see where they intersect, then count the rows. If > 0, then true, else false.
The one with null returns an error as it is an empty list, so the try/otherwise statement converts any error to false.
The above is the M code from the advanced editor. You can just paste this into a new Custom Column, though it will be formatted wierdly.
try List.Count( List.Intersect( { List.Transform(Text.Split([Requirement 1], ","), Text.Trim), List.Transform(Text.Split([Held Accomps], "&"), Text.Trim) } ) )>0 otherwise false
Try this PurdieB
#"Added Custom" =
Table.AddColumn(
#"Trimmed Text",
"Custom",
each
try
List.Count(
List.Intersect(
{
List.Transform(Text.Split([Requirement 1], ","), Text.Trim),
List.Transform(Text.Split([Held Accomps], "&"), Text.Trim)
}
)
)>0
otherwise false
You have to parse the values out into lists (the first uses & as a delimiter, the second uses a comma) then see where they intersect, then count the rows. If > 0, then true, else false.
The one with null returns an error as it is an empty list, so the try/otherwise statement converts any error to false.
The above is the M code from the advanced editor. You can just paste this into a new Custom Column, though it will be formatted wierdly.
try
List.Count(
List.Intersect(
{
List.Transform(Text.Split([Requirement 1], ","), Text.Trim),
List.Transform(Text.Split([Held Accomps], "&"), Text.Trim)
}
)
)>0
otherwise false