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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

compare two columns which are in the form of lists

Hi all,

 

I need to compare two columns which are in the form of lists. I am aware that I can achieve this by expanding and unpivoting (similar to this one : Solved: Difference between two list of values - Microsoft Power BI Community), but since I need to do this operation several times as I have multiple pair of columns that I need to compare, therefore I leave this approach at the bottom of the list. Is there a way to do this comparison in M Query or DAX or in general in Power BI (maybe R or Python too, do not know how to directly convert a list column to a panadas dataframe column) without expanding and unpivoting, I guess I am mainly looking for some programming or a quick way rather than building multiple tables and then joining them together (i.e expanding and unpivoting)

 

Sample of my columns:

Sichanm_0-1616370664577.png

 

 

 

 

1 ACCEPTED SOLUTION
rajulshah
Resident Rockstar
Resident Rockstar

Hello @Anonymous ,

 

Maybe the following M Query function can be helpful to you.
https://docs.microsoft.com/en-us/powerquery-m/list-difference
You can also go through all the List functions and see if any function fits your requirement.

Here, the user has used as following:
Text.Combine(List.Difference({"1", "2", "3", "4", "5"}, {"4", "5", "3"}),","). You can see the solution in his reply.

Let me know if this didn't help.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @rajulshah , I had to apply the Text.Combine function to return a nice string rather than a list

 

Text.Combine

 

Above function only works on string(text) , so the correct version is

Text.Combine(List.Difference({"1", "2", "3", "4", "5"}, {"4", "5", "3"}),",")

 

and the output

 

Sichanm_0-1616452828548.png

 

Maybe, just plz update your solution to accomodate this so the next person can jump to the solution quickly

 

rajulshah
Resident Rockstar
Resident Rockstar

Hello @Anonymous ,

 

Maybe the following M Query function can be helpful to you.
https://docs.microsoft.com/en-us/powerquery-m/list-difference
You can also go through all the List functions and see if any function fits your requirement.

Here, the user has used as following:
Text.Combine(List.Difference({"1", "2", "3", "4", "5"}, {"4", "5", "3"}),","). You can see the solution in his reply.

Let me know if this didn't help.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors