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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WillBeeSEA
Helper I
Helper I

How many duplicate rows deleted? --AND-- see which ones?

When I am building my data model and delete the duplicates in a query, is there a way to see how many duplicate rows will be removed?

 

Also, is there a way to see which rows are to be duplicated?

 

Thank you.

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @WillBeeSEA 

 

add a Index-columnn, then remove duplicates without checking the Index-Column. Afterwards you can filter your Original table. Here the M-code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJUitVBZhmhsJzALGO4GIJlApGNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, Text = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", Int64.Type}, {"Text", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1),
    RemoveDuplicates = Table.Distinct(#"Added Index", {"Key", "Text"}),
    RemovedRows = Table.SelectRows(#"Added Index", each not List.Contains(RemoveDuplicates[Index], [Index]))
in
    RemovedRows

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

2 REPLIES 2
Jimmy801
Community Champion
Community Champion

Hello @WillBeeSEA 

 

add a Index-columnn, then remove duplicates without checking the Index-Column. Afterwards you can filter your Original table. Here the M-code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJUitVBZhmhsJzALGO4GIJlApGNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, Text = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", Int64.Type}, {"Text", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1),
    RemoveDuplicates = Table.Distinct(#"Added Index", {"Key", "Text"}),
    RemovedRows = Table.SelectRows(#"Added Index", each not List.Contains(RemoveDuplicates[Index], [Index]))
in
    RemovedRows

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

artemus
Employee
Employee

You can do a group by (add all the columns as keys), and add a Count column. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors