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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Lachlanpap
Frequent Visitor

Deleting duplicates based on two criteria

Hello,

I have a table with duplicates in column 'A' I want deleted. I want the duplicate with the lowest value in column 'B' to be deleted. 

Any help would be greatly appreciated. Thanks

 

Lachlanpap_0-1714724125897.png

 

2 ACCEPTED SOLUTIONS
dufoq3
Super User
Super User

Hi @Lachlanpap, check this

 

Before

dufoq3_0-1714725253801.png

 

After

dufoq3_1-1714725264302.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRU0lEyNDMztDQGMoyNLJRidaKVjEwgohbGxmCGuSlY2AwibG4EVKajZGRqZoYibGpgCBeOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}, {"C", Int64.Type}}),
    GroupedRows = Table.Group(ChangedType, {"A"}, {{"All", each if Table.RowCount(_) > 1 then Table.SelectRows(_, (x)=> x[B] <> List.Min([B])) else _, type table}}),
    CombinedAll = Table.Combine(GroupedRows[All])
in
    CombinedAll

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

KRISHP1234
Helper I
Helper I

KRISHP1234_1-1714728421883.png

You can do by using group by, by selecting two column then group by with min value.

KRISHP1234_2-1714728495189.png

Step 1. 

KRISHP1234_3-1714728634181.png

Step 2.

KRISHP1234_4-1714728649672.png

 

 

 

View solution in original post

3 REPLIES 3
KRISHP1234
Helper I
Helper I

KRISHP1234_1-1714728421883.png

You can do by using group by, by selecting two column then group by with min value.

KRISHP1234_2-1714728495189.png

Step 1. 

KRISHP1234_3-1714728634181.png

Step 2.

KRISHP1234_4-1714728649672.png

 

 

 

Thanks for your help, both responses worked. 

dufoq3
Super User
Super User

Hi @Lachlanpap, check this

 

Before

dufoq3_0-1714725253801.png

 

After

dufoq3_1-1714725264302.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRU0lEyNDMztDQGMoyNLJRidaKVjEwgohbGxmCGuSlY2AwibG4EVKajZGRqZoYibGpgCBeOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}, {"C", Int64.Type}}),
    GroupedRows = Table.Group(ChangedType, {"A"}, {{"All", each if Table.RowCount(_) > 1 then Table.SelectRows(_, (x)=> x[B] <> List.Min([B])) else _, type table}}),
    CombinedAll = Table.Combine(GroupedRows[All])
in
    CombinedAll

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.