Learn more about the Alteryx Maveryx Universe recently announced at Inspire 2023!

Alteryx Designer Desktop Discussions

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

Formula to Count Duplicate Inputs

ejras02
6 - Meteoroid

Hi, 

 

I have a column of V_String inputs that have repeating values, I am trying to write a formula that will search that column for repeats and then output the corresponding number of repeats into a seperate column.

 

The column is last names, and I am trying to determine # of people in each family based on how many last names repeat. So, if the last name is Abbott and there are 10 Abbots in the Last Name column, I want 10 to appear next to each Abbott in last name in the FamilySize column next to it.

 

Hope that is clear.

 

Thanks! 

5 REPLIES 5
RodL
Alteryx Alumni (Retired)

I would use the Running Total tool. You can group by any field, so if you ensure that the Last Name column is sorted, you can group by the Last Name field which should start over the running total. 

You could then use a Summarize Tool and group by the Last Name and take the Max value of the Running Total column, and then join it back to your original data source so that the total shows up next to each name.

Let me know if you don't understand and I can put together a quick example.

Thanks,
Rod

ejras02
6 - Meteoroid

Doesn't the Running Total node only handle numeric values? I am still having some difficulty with this. 

 

RodL
Alteryx Alumni (Retired)

Sorry, yes, you are correct. What you could do is just add a column in a Formula tool that gives the constant of '1', and then do a running total on that.

But in creating an example for you, I figured out that is WAY overkill, and not sure why my mind went that way.  Smiley Embarassed

Just use a Summarize tool to begin with, group by the name, and count the number of records. Join that back to the original data set.

Example attached...

Sorry again to confuse...

Rod

ejras02
6 - Meteoroid

No problem! Thank you for the help! 

rahamrahimi
5 - Atom

Using  the following flow you would be able to label duplicate and count them later with Summarize tool

 

Capture.JPG

Labels