In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

Remove duplicates based on two columns

Jairacha
7 - Meteor

Hi,

 

I'd like to remove duplicate values of ID based on the Number1 and Number2 columns in the table. So for e.g. if ID#1 has a value in either Number1 or Number2, id like to keep ID#1 and remove the second row (duplicate ID#1) which has no values in Number1 or Number2. However, there are some rows that are already unique but don't have any values for Number1 or Number2 (ID#2) and I would NOT like to get rid of these.

 

Thank you!!!

 

IDFirstNameLastNameNumber1Number2
1BobSmith 555
1BobSmith  
2JamesBond  
3KevinBacon333777
4TylerPerry  
4TylerPerry  
5StevenMaria444 
2 REPLIES 2
ggruccio
ACE Emeritus
ACE Emeritus

HI @Jairacha,

 

I would create a Formula to evaluate the values in both fields and if both are null or empty then assign a value of 99999 otherwise a value of 1.  The formula below checks for IsEmpty (if your values are null you would just change to IsNull.)

 

ggruccio_0-1587129868089.png

Once that is complete your data will look like this:

ggruccio_1-1587129953044.png

Make sure to sort by ID and eval then attach a Unique tool configured for ID.

ggruccio_2-1587130010012.png

Unique only takes the first match for ID.  So you get the rows where there are data filled in for [Number1] or [Number2] and when an ID has neither filled it also keeps those.  You could then use a Select tool to remove the eval field if you want.

 

Final dataset:

ggruccio_3-1587130103862.png

 

 

 

 

 

 

Jairacha
7 - Meteor

Thanks @ggruccio !!

Labels
Top Solution Authors