Forum

Getting difference ...
 
Notifications
Clear all

Getting difference between 2 lists

3 Posts
2 Users
0 Reactions
73 Views
(@jaryszek)
Posts: 177
Reputable Member
Topic starter
 

Hi Guys,

i have 2 lists:

List

1
2
3

List

1
2
3
4

Screenshot_182.png

and now i want to get difference between them.

I tried with List.Difference but it is not working:

I should get result "4" as list (i want to use this in Table.RemoveColumns property) but i am getting empty List with query:

let
Source = List.Difference(Table1,Table13)
in
Source

Why? 

Please help,
Jacek

 
Posted : 10/06/2021 9:53 am
(@catalinb)
Posts: 1937
Member Admin
 

Why?

Short answer: because you do not read the documentation: https://docs.microsoft.com/en-us/powerquery-m/list-difference

It clearly says: Returns the items in list list1 that do not appear in list list2 

In english, list1 should be the longer list that might have items not in list2.

In your case, just change the position of the lists:

= List.Difference(Table13,Table1)

 
Posted : 10/06/2021 1:19 pm
(@jaryszek)
Posts: 177
Reputable Member
Topic starter
 

Thank you very much! 

It is awesome!

Jacek

 
Posted : 11/06/2021 3:55 am
Share: