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

Alteryx Designer Desktop Discussions

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

Convert 2 fields to one

LincolnMike
8 - Asteroid

Hello,

I need your assistance.

 

My source data has 4 fields of data:

 

VINMYVehQuesAns
12317xsoc1a25
12317xsoc275
45618bsoc1b35
45618bsoc285

 

I want SOC1a and SOC1b to be just one field (for all future answers SOC1b  replaced SOC1a, but I still require all the SOC1a for analytics).  

My output should be:

VINMYVehSOC1SOC2DIFF
12317x257550
45618b358550

 

But I am stuck with this:

VINMYVehSOC1aSOC1bSOC2Diff1Diff2
12317x25 7550 
45618b 3585 50

 

I am using Alteryx 10.6, and I attached a mockup.

 

thank you.

4 REPLIES 4
sjm
8 - Asteroid

Would it help to change your formula tool to only have the following calcs?

 

- Create a soc1_combined field

IF IsEmpty([soc1a]) THEN [soc1b] ELSE [soc1a]ENDIF

 

- Keep one difference calc

[soc2]-[soc1_combined]

 

- Remove the original soc1a and soc1b columns if needed (not totally clear to me if you need them or not)

jrgo
14 - Magnetar

@LincolnMike,

 


@LincolnMike wrote:

I want SOC1a and SOC1b to be just one field (for all future answers SOC1b  replaced SOC1a, but I still require all the SOC1a for analytics).



I'm not sure what you're referring to on the above because your desired output didn't seem to 'replace' anything else.

However, the updated workflow attached does generate an output to match what you're looking for. Note that I use REGEX to prep the value in "Ques" to remove any characters after the string pattern of SOC followed by 1 or more digits. If ALL your questions do not match that pattern, it may not operate properly. That said, this should give you some ideas on how to approach your solution.

 

image.png

LincolnMike
8 - Asteroid

thank you.   This worked.  That is so simple to use the IsEmpty.

I confused the issue...soc1a and soc1b just needed combining, and calling it SOC1combined is fine.

 

LincolnMike
8 - Asteroid

thank you jrgo.

I confused the issue...soc1a and soc1b just needed combining, and calling it SOC1 is fine.

and thanks for the REGEX example and explanation.  I believe I have another use for that in other queries.

 

 

Labels
Top Solution Authors