Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Fastest way to merge multiple columns with exclusive NULL/non-NULL combos

Rajko
7 - Meteor

Hi, I have some columns that looks as follows, due to changes in an underlying data model:

 

Col 1   |    Col 2

  XX    |   

           |    YY

  ZZ     |    

           |    QQ

 

I want to make it like this:

 

Col 3 

XX   

YY

ZZ

QQ

 

Basically, if one col has a value, the other is always Null. The things is, I possibly have 25 pairs of columns like this and would really like to avoid manually making a IF (NULL) Then ... formula for every single one. Any tips on a fastest way to do this? Ideally all I would manually do is specify the row combinations...

 

One thing that has occurred to me is transposing the columns to rows, then change the names of pairs to be the same, then cross-tabing back.. Alternatively, concatenating the columns but I need to be careful about NULL vs. empty strings and types 😕

 

I guess I might end up doing that, but curious if I am missing anything else + trying to learn best practices! 

 

Thank you!

Rajko

8 REPLIES 8
kelsey_kincaid
12 - Quasar

Hi @Rajko ,

Does the below represent your desired output?

 

Col 1   |    Col 2

  XX    |   YY

  ZZ     |    QQ

Rajko
7 - Meteor

sorry, realized I didnt clarify that, adding now!

AngelosPachis
16 - Nebula

Hi @Rajko ,

 

Assuming that your input looks something similar to the following:

 

AngelosPachis_0-1611346605985.png

 

then I believe the attached workflow will return you the output you are looking for

 

AngelosPachis_1-1611346643699.png

 

Hope that helps, let me know if that worked for you.

 

Regards,

 

Angelos

Rajko
7 - Meteor

Yeah thats awesome thanks so much!!

kelsey_kincaid
12 - Quasar

Hi @Rajko ,

Something like this should work and would work for any number of columns. Let me know what you think!

 

kelsey_kincaid_0-1611347947386.png

 

Edit: Whoops! Looks like @AngelosPachis beat me to it. Glad you got what you needed!

Rajko
7 - Meteor

Im looking at your multirow formula and don't understand why the columnIDs start repeating after it its 6? What causes the loop to reset?

 

Rajko_1-1611348826785.png

 

Rajko_0-1611348820599.png

 

Rajko
7 - Meteor

Still interesting for me to see approaches, thank you!

AngelosPachis
16 - Nebula

Great questions @Rajko ,

 

If you look at the configuration window of the multi-row formula tool, I have grouped on the field Record ID.

 

Screenshot 2021-01-22 205613.jpg

 

That causes the calculation to reset, for each distinct Record ID value in my dataset, and that's what causes the Column ID to start repeating after 6.

Labels