Forum Discussion

SriKandimalla's avatar
6 years ago
Solved

How to remove duplicates using a condition

Hello Power BI Community,   I am trying to figure out couple of things: 1) Either to remove the duplicate rows  OR 2) To avoid them in my count column I have a dataset where 1 employee can be...
  • ChrisMendoza's avatar
    ChrisMendoza
    6 years ago

    SriKandimalla -

    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)')