Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Keep only one record

john_armentrout
6 - Meteoroid

Hi - 

 

I have the following situation - I have some duplicate rows (for example, the first two in this sample set), I want to keep only the row where the PartTypeValue is "MPS":

 

NameSiteIDPartTypeValueMin_Warehouse
00-011085300MPSWH3000
00-011085300MakeWH3000
20402100MakeUSA102
20402110MakeWH1101
20402112MPSWH1008
20402112MakeWH1008
20402113MakeUSA204
20402114MakeWH1009
20402120MakeUSA101
20402200MPSUSA201
20402300MakeUSA301
20402400MakeIRL101

 

What is needed is a single record (unique to Name and SiteID) - keeping the MPS record when applicable:

 

NameSiteIDPartTypeValueMin_Warehouse
00-011085300MPSWH3000
20402100MakeUSA102
20402110MakeWH1101
20402112MPSWH1008
20402113MakeUSA204
20402114MakeWH1009
20402120MakeUSA101
20402200MPSUSA201
20402300MakeUSA301
20402400MakeIRL101

 

Not sure how to "remove" the second, non-MPS record in those instances were I have two records for a unique Name-SiteID combination.

 

thanks - john

6 REPLIES 6

Hello @john_armentrout 

 

Will it always be MPS or Make? If yes, you can sort the data by Name, then by PartTypeValue in a descending order then add a Unique tool to remove duplicates based on Name and Site ID like below.

christine_assaad_0-1634684231056.png

 

john_armentrout
6 - Meteoroid

it will always be MPS, if there is an MPS row - otherwise, it would be Make (there is another value, "Buy", that is treated the same way - MPS overrides both, otherwise whatever the other value is).  Let me try what you suggested...

 

Chantelb
9 - Comet

Hi @john_armentrout ,

 

If there are other possible values for PartTypeValue you could use a join and filter in addition to the unique tool to make sure you always get MPS:

 

Chantelb_0-1634684579650.png

 

john_armentrout
6 - Meteoroid

as expected, the approach works for MPS and Make - but not for MPS and Buy.  In my 15000 rows, I have examples of "duplicates" with MPS and Make, and MPS and Buy.  always need MPS to win...

 

john_armentrout
6 - Meteoroid

@Chantelb Thanks - that seemed to do it.  I'm validating, but thanks much!

john_armentrout
6 - Meteoroid

@Chantelb - validated,thanks again

Labels