Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

New column based on conditions

pranee_007
7 - Meteor

Inputfile1

ZABC
1Fund1Entity1 
2Fund2Entity2 
3Fund3Entity3 
           4Fund5Entity1 
5Fund4Entity4 

 Inputfile 2

ZXY
1ah
2sy
3dr
4fj
5de
6fg

 

Team,

 

I am looking to create new column as shown above.

Conditions:

1. If (A=fund1 or B=Entity1 or B=entity2) then fill column c with value 'zero'

 

2. If(B=entity3 or B=entity4) then value of column c will be the lookup value of corresponding value of its Z in source2 and returns the corresponding value from column y.

 

Example: If B= entity3 then z value is 3. so it checks for this z in source 2 and take the value of column y corresponding to z=3 which is 'r' and keeps it in column c of first table.

 

Please help me how to build this logic.

 

2 REPLIES 2
RolandSchubert
16 - Nebula
16 - Nebula

Hi @pranee_007 ,

 

you need a Join tool and a Formula tool to build this logic.

Join inputfile1 and inputfile2 on field [Z]. Then add a Formula tool with a formula to calculate column [C]:
IF [A] = 'Fund1' OR [B] IN (Entity1, Entity2) THEN
   0
ELSE
  [Y]    <- the column you added by the join before
ENDIF
I've added a sample workflow using this approach.

 

Another option would be to use a Fitler tool to split between the rows with Fund1 or Entity1/Entity2 and the other rows.
You would join only the "other rows" with inputfile2, use the formula to fill field [C] and use Union to reunion all rows.

 

Best regards

 

Roland

JoeS
Alteryx Alumni (Retired)

Hi @pranee_007 

 

I have built a workflow to follow you logic.

 

I used a filter tool and formula tool for part 1.

 

Then joined the datasets together for part 2 and replace column c from column y, by renaming in the join tool.

 

Then unioned the data back together.

 

2019-10-24_17-02-06.png

 

 

Edit: Doh, beaten to it by the time I wrote my post and solution. Similar stuff done though 🙂

Labels
Top Solution Authors