Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Merging duplicate records with a transform


Alteryx community,


I have a record set where Column A contains unique identifiers, Column B contains a string, and Column C contains a numerical value. However, in the record set, there may be duplicates in Column A. What I'd like to do is merge the duplicate rows so that the unique identifier is retained, as well as the string in Column B where the numerical value was higher in Column C.


(Note: Rows 1 and 2 were originally part of separate tables, and were unioned.)


An example:


Column AColumn BColumn C


In this case, I want to retain "Dog" from Row 1 because the numerical value is 100 but add the 10 from Row 2. The end result should transform to this:


Column AColumn BColumn C


I can do this in SQL using SUM and CASE WHEN clauses and I'd imagine I'm using the Summarize and/or Filter nodes, but I can't quite figure it out.

Alteryx Partner

This is what I would do :


2019-03-14 08_27_47-Alteryx Designer x64 - merge dupes.yxmd.png


The sort does 2 things .... puts all the same A values together (in case there's a different record in the middle), then puts the larger value of C first.


The Unique tool grabs the first A record and the rest go out the D(uplicates) output.


Hi @essemMLB ,


The Summarize tool calaculates the total sales per unique ID. You can use Sort to order the data by ID, and then by the value field with highest on top. A sample tool, grouped on the ID field, will pull the record with the highest value per record ID (using First N records and set N to 1).

Join back together, and you have your answer. Attaching a sample workflow because I'm unable to post pictures today.





Thank you both for your answers, and the solution! I appreciate it!

Alteryx Partner

Ah sorry, I missed that you wanted the 2 values added together in the output :)