Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
heberpower
Frequent Visitor

How can I remove distinct values in a column? The opposite of remove duplicates.

I have a weird situation where I find myself needing to remove distinct values rather than duplicates. I just need a see the duplicates only. My brain hurts now.
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @heberpower ,

 

Believe that there is no option directly for this as there is for distinct try the following:

  • Make a Group By on the column you want to keep the duplicates
  • Agreggate the count of the rows
  • Merge the step before the group by with the aggregated 
  • Expand the count column
  • Filter out values equal to 1

See code below for a simple test:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXJOLDFUitVB4zghc5whHCMCHBdkjit2TiwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Values = _t, Cat = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Values", type text}, {"Cat", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Values"}, {{"Count", each Table.RowCount(_), type number}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Values"}, #"Grouped Rows", {"Values"}, "Grouped Rows", JoinKind.LeftOuter),
    #"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"Count"}, {"Count"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Grouped Rows", each ([Count] <> 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Count"})
in
    #"Removed Columns"

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @heberpower ,

 

Believe that there is no option directly for this as there is for distinct try the following:

  • Make a Group By on the column you want to keep the duplicates
  • Agreggate the count of the rows
  • Merge the step before the group by with the aggregated 
  • Expand the count column
  • Filter out values equal to 1

See code below for a simple test:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXJOLDFUitVB4zghc5whHCMCHBdkjit2TiwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Values = _t, Cat = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Values", type text}, {"Cat", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Values"}, {{"Count", each Table.RowCount(_), type number}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Values"}, #"Grouped Rows", {"Values"}, "Grouped Rows", JoinKind.LeftOuter),
    #"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"Count"}, {"Count"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Grouped Rows", each ([Count] <> 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Count"})
in
    #"Removed Columns"

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors