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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
guy17829393
New Member

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

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @guy17829393 ,

 

This is my test data.

vtangjiemsft_0-1711690567392.png

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.

vtangjiemsft_1-1711690651819.png

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. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @guy17829393 ,

 

This is my test data.

vtangjiemsft_0-1711690567392.png

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.

vtangjiemsft_1-1711690651819.png

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. 

danextian
Super User
Super User

Hi @guy17829393 

 

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?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.