Forum Discussion
How to remove duplicates using a condition
- 6 years ago
Are you trying to achieve:
Measure = COUNTROWS(DISTINCT(TableName))Can also be accomplished as:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKk7MVdJRSjQ0VIrVgfOMjHDzjI3BvKxMEC8Jqg/Kg6qE8lBVEs8zMUHmmZqCeXmZyfk5qUhORQhAdSMEMLSA3BULAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [employee = _t, task = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"employee", type text}, {"task", type text}}), #"Removed Duplicates" = Table.Distinct(#"Changed Type") in #"Removed Duplicates"with
Measure 2 = COUNTROWS('TableName (2)')
Go to Power Query, Home tab, Remove Rows, Remove Duplicates.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
- SriKandimalla6 years agoHelper I
Hey Nathaniel_C ,
Thanks for the response. I cannot delete the entire duplicates. I can assign the same task to multiple employees but the rule is each employee can have a particular task only once. So, I have to remove the rows where the count >1(excluding the 1st row with the duplicate, since I will lose the original row). But cannot remove all of them.
- Nathaniel_C6 years agoCommunity Champion
Hi SriKandimalla ,
Go to Power Query, and try it. You can always reverse it. Remove Duplicates, means after the first one.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel- SriKandimalla6 years agoHelper I
Hey Nathaniel_C ,
I just tried it, it has left my table with unique values of task.
I need the duplicates as well to be able to assign the same to task to various employees. What I need to get rid of are the ones with duplicated of (Employee & task) combined.