Forum

Notifications
Clear all

Duplicates

5 Posts
3 Users
0 Reactions
78 Views
(@jvdw)
Posts: 15
Eminent Member
Topic starter
 

Dear,

I now that it's very easy to remove duplicates via power query, but I have an example where I don't want to remove all duplicates. 

For example:

I have material where I have components with 2 cylinder ends which isn't correct. But I also have several disc's, which are correct.

But of the cylinder end, I need only the second, version 3 / M05803300 and I wanted to remove the version 4.

The example is showing only one material number, but I have more then 1.000 is my real example. And both components are existing otherwise it was easy. Can I remove duplicates, without touching all duplicates? See attachement "duplicates" for example

PlantMaterialMaterial DescriptionAlternative BOMExplosion levelComponentComponent DescriptionComponent Qty

STM1 M01167210 SHOCK ABSORBER 1 4 M05803000 CYLINDER END 1
STM1 M01167210 SHOCK ABSORBER 1 3 M05803300 CYLINDER END 1
STM1 M01167210 SHOCK ABSORBER 1 2 M10010192 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 3 M100250A1 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 3 M100250A3 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 3 M100250A3 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M100252A7 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M100252F3 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M100252K2 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M100252K4 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M100252K5 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M10040108 DISC 1
STM1 M01167210 SHOCK ABSORBER 1 2 M10050301 DISC 1
 
Posted : 01/07/2021 5:42 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Johan,

If you don't want the 4 Cylinder End then I'd create another column that concatenates the Explosion Level and Component columns together, then you can use the Filters on that new column to filter out the 4 Cylinder End records.

Mynda

 
Posted : 01/07/2021 8:00 pm
(@jvdw)
Posts: 15
Eminent Member
Topic starter
 

Hey Mynda,

Thanks for your reply.

In those examples, it was indeed explosion level 4, but it can be 3, 5  or 6 as well.

But is always be the highest level. I guess this is to complicated?

I added a few examples. 

Kind regards,

Johan

PlantMaterialMaterial DescriptionAlternative BOMExplosion levelComponentComponent DescriptionComponent Qty

STM1 M01167210 SHOCK ABSORBER 1 4 M05803000 CYLINDER END 1
STM1 M01167210 SHOCK ABSORBER 1 3 M05803300 CYLINDER END 1
STM1 M01167218 SHOCK ABSORBER 1 4 M05803000 CYLINDER END 1
STM1 M01167218 SHOCK ABSORBER 1 3 M05803300 CYLINDER END 1
STM1 ME1021202 SHOCK ABSORBER 1 4 M05803300 CYLINDER END 1
STM1 ME1021202 SHOCK ABSORBER 1 5 M05803000 CYLINDER END 1
STM1 MEP121402 OE PACKED 1 5 M05803300 CYLINDER END 1
STM1 MEP121402 OE PACKED 1 6 M05803000 CYLINDER END 1
 
Posted : 02/07/2021 8:47 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Johan,

If you want to keep some records based on component description, we can build a workaround.

For example, you can add an Index column and another column with this formula:

if Text.Contains([Component Description],"CYLINDER END") then [Component Description] else [Component Description] & Text.From([Index])

This new column will contain values like this:

CYLINDER END

CYLINDER END

DISC3

DISC4

DISC5

This way, Cylinder will be identified as duplicates, but DISC will have an additional unique index added in order to avoid removing them.

You can use this column, with other columns that together will create a unique key to remove duplicates.

It can be any other column, not necessarily the description:

if Text.Contains([Component Description],"CYLINDER END") then [Material] else [Material] & Text.From([Index])

 
Posted : 02/07/2021 2:08 pm
(@jvdw)
Posts: 15
Eminent Member
Topic starter
 

Hey Catalin, 

Wow, this is working perfectly. I had to add the material as well, but this is working perfectly.

"if Text.Contains ([Component Description],"CYLINDER END") then [Material]&[Component Description] else [Material]&[Component Description]&[Index]"

Thanks a lot.LaughSurprisedWink

 
Posted : 03/07/2021 7:41 am
Share: