Alteryx Designer Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!

SOLVED

How to duplicate and shift columns

bruno_
6 - Meteoroid

Hey guys, I'm struggling with this operation in Alteryx and I would be very grateful if someone could help me. I tried to use formula, multi-field formula, multi-row formula but couldn't make it so far. 

 

It is just a meaningless example below, but I want to duplicate columns from A to C, giving them a new name (in the example newA, newB and newC) and shifting them down like this:

newA  = A shifted down by 0 cell 

newB = B shifted down by 1 cell  

newC = C shifted down by 2 cells

and so on...

 

Also, where might be Blanks or Nulls in consequence of the shifting, I want to put a 0.   

 

Before

NameABC
Name11611
Name22712
Name33813
Name44914
Name551015

 

After

NameABCnewAnewBnewC
Name11611100
Name22712260
Name338133711
Name449144812
Name5510155913
AngelosPachis
14 - Magnetar

Hi @bruno_ ,

 

EDIT : missed the shift part

 

One way would be with a multi-field formula tool

 

AngelosPachis_0-1613154748473.png

 

 

Regards,

 

Angelos

pedrodrfaria
12 - Quasar

Hi @bruno_ 

 

See the solution below:

 

pedrodrfaria_0-1613154808234.png

Pedro.

bruno_
6 - Meteoroid

Ok, it works for the duplication, but what about the conditional shifting?

pedrodrfaria
12 - Quasar

Hi @bruno_ 

 

I'm not sure you are responding to my post or the one above. But for the solution I provided, did I get the shifting logic incorrectly?

 

Pedro.

bruno_
6 - Meteoroid

Thanks guys @AngelosPachi and @pedrodrfaria.

 

Your worfklow worked, Pedro.

 

I just have another issue: what if the number of columns are bigger? I have to do this operation in dozens of columns and with this program I would have to use the Multi-row formula tool dozens of times. Is there any other way?

AngelosPachis
14 - Magnetar

Hi @bruno_ ,

 

Sorry for missing that, here is a better solution than the one I provided earlier. This one actually does what you have asked, and will work for any number of columns.

AngelosPachis_0-1613155547809.png

 

 

Cheers,

 

Angelos

 

bruno_
6 - Meteoroid

Thanks!! 

Labels