Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Generate new row and copy data from specified row above based on condition

snwk
5 - Atom

Hi guys, I'm new to Alteryx and couldn't figure out a way how to do this, maybe someone can help.

I have an input table that looks like the following:

Location (header)
Berlin
Berlin
Munich
Munich
London
London

I'd like to generate a new row whenever there's a new location (active row does not equal row -1) and copy the data from the first row (header). The Output should look like this:

Location
Berlin
Berlin
Location
Munich
Munich
Location
London
London

 

It would also be necessary to save every location in a new excel sheet (within the same workbook). 

 

Thanks and kind regards!

14 REPLIES 14
ShankerV
17 - Castor

Hi @snwk 

 

Step 7: Filter tool

 

ShankerV_0-1674123181560.png

 

ShankerV_1-1674123189026.png

 

Step 8:

ShankerV_2-1674123209822.png

 

ShankerV_3-1674123220808.png

 

Expected output:

ShankerV_4-1674123245629.png

 

Many thanks

Shanker V

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

One way to rearrange the data:

From this:

BS_THE_ANALYST_0-1674123181894.png

to this

BS_THE_ANALYST_2-1674123579959.png

 

The workflow depends on the header being called 'Location' though. If you change it, the workflow will prompt you to tick the boxes for the new header name. 

 

 

All the best,
BS

LinkedIN

Bulien
snwk
5 - Atom

Thank you, it worked!!

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@snwk I've made the solution dynamic now - thanks to @ShankerV 's workflow/logic. You can select whatever column name you like, and aslong as there's a subheading, this workflow will arrange your data into groups (they may be mixed up i.e. London, Berlin, London, London), then output what you required. 

 

Thanks for the question, this was a great learning for me! 😀

 

BS_THE_ANALYST_0-1674133104370.png

 

All the best,
BS

LinkedIN

Bulien
ShankerV
17 - Castor

Hi @BS_THE_ANALYST 

 

Thanks. Good to know my workflow/logic helped you too....

Labels