I am trying to perform an operation in Excel using Powerquery.
I want to remove contacts in a list if they are connected to a certain CompanyID but are listed with a different CompanyName.
The fist step is to filter them out by comparing to the row above. They are always listed consecutively.
Next step is to remove all rows containing the value delete in the delete column but unfortunately I do not get to that step.
I have looked at this post and have tried with the following code:
= Table.AddColumn(#"Added index", "Delete", each if [CustomerID]= #"Added index"{[ContactID]-1}[CustomerID] and [CompanyName]<> #"Added index"{[ContactID]-1}[CompanyName] then "delete" else null)
But I get this error:
There were too many elements in the enumeration to complete the operation
I have googled the error and it seems to be connected with duplicated column names but I do not have any of those.
Please help!