Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Expand counts to be units with value 1

Roche
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 ANTWORTEN 5
Sebastiaandb
Quasar

@Roche 

Here you go!

 

Sebastiaandb_0-1636450502366.png

 

Greetings,

 

Seb

 

JoeS
Alteryx Alumni (Retired)

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
Asteroid

Thank you for helping Sebastiaan and Joe!

 

Sebastiaandb
Quasar

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

Roche
Asteroid

Thank you Sebastiaan, enjoy your day!

Beschriftungen
Top-Lösungs-Autoren