Reputation: 67
I want to use power query to remove rows with duplicate values in a column containing e-mail addresses. But I do not want to remove rows with duplicate null values or duplicate empty cells.
How do I accomplish that?
Upvotes: 0
Views: 2626
Reputation: 67
I came up with a different solution to the problem.
Worked fine with me!
I thought that I should share the solution if anyone else can be helped by it.
Upvotes: 1
Reputation: 2967
Split the table in records with nulls/"" and other records. Remove duplicate emails from the latter table. Append both tables.
let
Source = Input,
Empties = Table.SelectRows(Source, each [Email] = null or [Email] = ""),
Others = Table.SelectRows(Source, each [Email] <> null and [Email] <> ""),
RemovedDuplicateEmails = Table.Distinct(Others, {"Email"}),
Appended = Table.Combine({RemovedDuplicateEmails,Empties})
in
Appended
Upvotes: 2