Alteryx Designer Desktop Discussions

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

Filter with both OR and AND

taraohare
5 - Atom

Hi, I want to create a filter that excludes data IF

Column A = X OR Y OR Z

AND 

Column B = 0

 

Any help on this would be great!

5 REPLIES 5
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @taraohare,

 

You could use the IN() function:

 

[Column A] IN ("X", "Y", "Z") AND [Column B] = 0

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Regards,

Jonathan

DavidP
17 - Castor
17 - Castor

You can put all the OR statements in brackets

 

([Column A] = X OR [Column A] = Y OR [Column A] = Z) AND [Column B = 0]

taraohare
5 - Atom

Hi Jonathan, 

 

I am getting a 'Parse Error at Char (85): Malformed if statement' when i use the below:

 

IF [Transaction Code] IN ("CEXP", "CEXP-", "RCEXP") AND [Real FX GL on Rec Pay] = 0 ENDIF

 

Can you see whats going wrong here?

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @taraohare,

 

If you've got this expression in a filter tool you'll need it to be a boolean expression and not an IF statement, try changing it to:

 

[Transaction Code] IN ("CEXP", "CEXP-", "RCEXP") AND [Real FX GL on Rec Pay] = 0

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Regards,

Jonathan

ChrisTX
15 - Aurora

you need a THEN clause and an ELSE clause

 

Each IF condition requires an ELSE clause, even if the ELSE value is Null()

 

Here is a list of all functions: https://help.alteryx.com/current/Reference/Functions.htm

   The IF function is the first one listed under the section for Conditional

 

Chris

 

Labels