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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Felix_0905
New Member

Duplicate filter

Hello,
Can someone tell me how to quickly duplicate duplicates which at the end of the respective name is only ever there.

Thanks and Greetings

 

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

My interpretation of your question in this video resulting in the following code (the first line was created when I entered the data before I started the recording):

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k0sSk7NcUotTVfILFbIz8upVEgtSy1SKMlILUpVitUhRoVbak5mRbyBpYEpSEUeBbIYpscCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t]),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.EndsWith([Name], "only ever there")),
    #"Kept Duplicates" = let columnNames = {"Name"}, addCount = Table.Group(#"Filtered Rows", columnNames, {{"Count", Table.RowCount, type number}}), selectDuplicates = Table.SelectRows(addCount, each [Count] > 1), removeCount = Table.RemoveColumns(selectDuplicates, "Count") in Table.Join(#"Filtered Rows", columnNames, removeCount, columnNames, JoinKind.Inner),
    #"Added Custom" = Table.AddColumn(#"Kept Duplicates", "Custom", each {1..2}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Custom"})
in
    #"Removed Columns"
Specializing in Power Query Formula Language (M)

View solution in original post

1 REPLY 1
MarcelBeug
Community Champion
Community Champion

My interpretation of your question in this video resulting in the following code (the first line was created when I entered the data before I started the recording):

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k0sSk7NcUotTVfILFbIz8upVEgtSy1SKMlILUpVitUhRoVbak5mRbyBpYEpSEUeBbIYpscCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t]),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.EndsWith([Name], "only ever there")),
    #"Kept Duplicates" = let columnNames = {"Name"}, addCount = Table.Group(#"Filtered Rows", columnNames, {{"Count", Table.RowCount, type number}}), selectDuplicates = Table.SelectRows(addCount, each [Count] > 1), removeCount = Table.RemoveColumns(selectDuplicates, "Count") in Table.Join(#"Filtered Rows", columnNames, removeCount, columnNames, JoinKind.Inner),
    #"Added Custom" = Table.AddColumn(#"Kept Duplicates", "Custom", each {1..2}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Custom"})
in
    #"Removed Columns"
Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.