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

If - Help

B_Y_ID8
7 - Meteor

Hi all,

 

I am trying to introduce another part to my formula (enclosed as New Workflow 1) whereby:

 

if IsNull(Cat1) and IsNull(Cat2) Then

Check Category against Other1

Check Category against Other2

Check Category against Other3

Check Category against Other4

If Match Then Yes

Else No

 

For example on screenshot provided(Image): I would expect Row 8, 10, 13 and 14 to come back as Yes. Row 4 seems to be correct as doesnt match.

 

Any help please. I have been struggling to get the next part of the IF to be added to my existing IF statement.

 

Thanks

22 REPLIES 22
atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @B_Y_ID8 

 

Cheers and Happy Analyzing 😀

atcodedog05
22 - Nova
22 - Nova

@B_Y_ID8 

 

Oh ok. Glad to hear it got solved.

 

Thanks for marking my post as solution🙂

B_Y_ID8
7 - Meteor

Wonder if you would be able to help on another if statement:

 

I have enclosed sample data.

 

By logic: If Column A has value use Column A (I have this bit working). Else If Column A is Null look to Column C. If Column C is True look at Column B and work out depending on Column B which it then falls into ie 3,7,12 would be 1.

 

My code at the moment is:

 

If isNull(Column A) Then

If tostring([Column C]) = "True" Then

If ([Column B]) in ('3','7','12') Then 1

If ([Column B]) in ('16','18','19') Then 2

If ([Column B]) in ('24','27','32') Then 3

 

Hopefully that gives you enough info to work on. Struggling to get something that Alteryx likes as a formula.

 

Thanks

atcodedog05
22 - Nova
22 - Nova

Hi @B_Y_ID8 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1604512836272.png

Formula:

IF IsNull([Column A]) and [Column C]=1 THEN 
IF ToString([Column B]) in ('3','7','12') THEN 1 
ELSEIF ToString([Column B]) in ('16','18','19') Then 2
ELSEIf ToString([Column B]) in ('24','27','32') Then 3
ELSE Null() ENDIF
ELSE Null() ENDIF

Workflow:

atcodedog05_1-1604512849590.png

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

atcodedog05
22 - Nova
22 - Nova

@B_Y_ID8 

 

and just a pointer Bool translates to 1 and 0 even when its converted to string

atcodedog05_0-1604513273441.png

Hope this helps 🙂

Maskell_Rascal
13 - Pulsar

Hi @B_Y_ID8 

 

Try this:

 

IF IsNull([Column A]) AND ToString([Column C])="True" THEN 
IF ToString([Column B]) in ('3','7','12') 
THEN 1 
ELSEIF ToString([Column B]) in ('16','18','19') 
THEN 2
ELSEIF ToString([Column B]) in ('24','27','32') 
THEN 3
ELSE Null() ENDIF
ELSE Null() ENDIF

 

Thanks!

Phil

Maskell_Rascal
13 - Pulsar

@atcodedog05 That's really clever to use a Bool for your true/false statement in the formula. I'm gonna have to remember that one. Thanks for the tip!

B_Y_ID8
7 - Meteor

That was quick atcodedog05.

 

Sorry - prob wasnt clear but the expecting column would be values that end up in Column A

 

Thanks

atcodedog05
22 - Nova
22 - Nova

Hi @B_Y_ID8 

 

Is this the expected output

atcodedog05_0-1604513940346.png

Please revert back quickly i might be going offline in sometime

Maskell_Rascal
13 - Pulsar

@B_Y_ID8 

 

Change the last Null() to [Column A] and you'll be covered. 

 

IF IsNull([Column A]) and [Column C]=1 THEN 
IF ToString([Column B]) in ('3','7','12') THEN 1 
ELSEIF ToString([Column B]) in ('16','18','19') Then 2
ELSEIf ToString([Column B]) in ('24','27','32') Then 3
ELSE Null() ENDIF
ELSE [Column A] ENDIF

 

Maskell_Rascal_0-1604514008719.png

 

Thanks!

Phil

Labels
Top Solution Authors