In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Copy Row 'x' (defined in another column) times

Dezzie
5 - Atom

I have a data set that specifies a list of values and the number of times to "copy" them. For example,

 

FruitCopy Num
Apple2
Orange4
Banana3

 

The output set I'm trying to achieve is this:

 

Fruit
Apple-1
Apple-2
Orange-1
Orange-2
Orange-3
Orange-4
Banana-1
Banana-2
Banana-3

 

I looked into the Multi-Row Formula tool but wasn't able to figure out how to go about doing this. Does anyone have any suggestions?

4 REPLIES 4
NicoleJohnson
ACE Emeritus
ACE Emeritus

Try the attached!

 

1. Use the Generate Rows tool to create a new line for every number X-1 until you get to 1

2. Formula tool to concatenate the original column name with the new RowCount # to get your combination

 

Does that work? :)

 

NJ

adm510
11 - Bolide

Use the generate rows tool. Take a look at the example I attached

wvonderrosen
5 - Atom

Clutch!, thank you!

rebekajackson
5 - Atom

Brilliant, I needed a very similar solution - but mine was because the "count" needed to combine with the "unique string" to get a field with "unique string.1,...,unique string.count".

 

I wasn't sure if my data had unique rows so I added a record ID before I duplicated the rows, before including that in the "group by" and "concatenate" steps to get what I needed.

 

Never used the generate rows tool before, very helpful!

Labels
Top Solution Authors