Forum Discussion
Check if 2 not sorted string contain the same data
I have a problem I want to check if 1 string is the same than another but in a diferent order in a table measure
Example:
string1= Jupiter,mercury
string2= mercury,Jupiter
and return "yes" if its the same or "no" if its different
- Anonymous2 years ago
Hi Anonymous ,
This is my test data.
Adding a custom column in the power query editor.
= if Text.Combine(List.Sort(Text.Split([String1], ",")), ",") = Text.Combine(List.Sort(Text.Split([String2], ",")), ",") then "yes" else "no"Then the result is as follows.
If I have misunderstood you please clarify in a follow up reply.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- danextianSuper User
Hi Anonymous
The approach depends on how you are going to compare the two strings. Are you selecting from two dropdowns, etc? Are they from separate tables? Same column but different rows?
- AnonymousNot applicable
Hi Anonymous ,
This is my test data.
Adding a custom column in the power query editor.
= if Text.Combine(List.Sort(Text.Split([String1], ",")), ",") = Text.Combine(List.Sort(Text.Split([String2], ",")), ",") then "yes" else "no"Then the result is as follows.
If I have misunderstood you please clarify in a follow up reply.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.