Forum Discussion
sanjanarama
4 years agoResolver I
comparing values with comma
| ID | parent Names | Family Names | Match |
| 1 | Apple, Orange | Fruit, Lemon, Grapes | no |
| 2 | Lemon,grapes, Fruit | Grapes, Fruit, Lemon | yes |
| 3 | Hello, Fridge, Door | Fridge, hello | no |
| 4 | balcony | Balcony | yes |
| 6 | tree, time | time | no |
two columns with comma seperated values, output should show , match or not matched.
I tried below m query but it is not working
if List.ContainsAll(Text.Split([parent Names],","),Text.Split([Family Names],",")) then "Yes" else "No"
Can anyone help me
I do not want to perform pivot/unpivot
= Table.AddColumn(#"Changed Type", "Match", each let p = List.Transform(Text.Split([parent Names], ","), Text.Trim), f = List.Transform(Text.Split([Family Names], ","), Text.Trim) in List.Count(p) = List.Count(f) and List.Count(List.Difference(p, f, Comparer.OrdinalIgnoreCase)) = 0 )
2 Replies
- CNENFRNLCommunity Champion
= Table.AddColumn(#"Changed Type", "Match", each let p = List.Transform(Text.Split([parent Names], ","), Text.Trim), f = List.Transform(Text.Split([Family Names], ","), Text.Trim) in List.Count(p) = List.Count(f) and List.Count(List.Difference(p, f, Comparer.OrdinalIgnoreCase)) = 0 )- sanjanaramaResolver I
worked like a charm