Alteryx Designer Desktop Discussions

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

Expand counts to be units with value 1

Roche
8 - Asteroid

I have sales data with columns Receipt, Item and Number of units bought.  I would like the Number of units bought to be expanded from their original values to units of 1, i.e. such that if Receipt 1 has 2 units of Product A, then 2 rows will be created and the same method for all the other counts which are greater than 1 units.  In the attached excel file is an example of what the data looks like and an example of what the outcome should be.  Thank you

5 REPLIES 5
Sebastiaandb
12 - Quasar

@Roche 

Here you go!

 

Sebastiaandb_0-1636450502366.png

 

Greetings,

 

Seb

 

JoeS
Alteryx
Alteryx

Hi @Roche 

 

The Generate rows is perfect for what you want to do here.

 

There are a couple ways you can set it up, but I have gone with creating a new column to check it was building it successfully:

Screenshot 2021-11-09 093526.png

 

I loaded in the value needed (Initialization Expression) > checked that value is always greater than 0 (Conditional Expression) > when it's not subtract one and create a new row (Loop Expression)

 

I have attached the workflow as well. Let me know if you have any questions

 

Roche
8 - Asteroid

Thank you for helping Sebastiaan and Joe!

 

Sebastiaandb
12 - Quasar

@Roche Glad to help you out! Have a nice day!

Roche
8 - Asteroid

Thank you Sebastiaan, enjoy your day!

Labels