community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Multicolumn filter and multiple possible answers

Atom

Hi All,

 

I am trying to write a multiple criteria to my filter:
If Column 1 = a and Column 2 = 5 then include or
if Column 1 = b and Column 2 = 5 then include or 
if Column 1 = c and column 2 = 6 then include or etc....

 

Could you please advise what is the best function to use on such filtering and what the Syntax would be?

 

Thank you for your help, much appreciated.

 

Michal

Highlighted
Alteryx Certified Partner

Hi @MichalJ

 

Check out this solution. Hope it helps.

FILTER11.PNG

Quasar

You can use the Custom filter option of the Filter Tool with an expression like

 

([Column 1] = "a" and [Column 2] = 5)  or
([Column 1] = "b" and [Column 2] = 5) or 
([Column 1] = "c" and [column 2] = 6)

 

you could also simplify to

 

([column 1] in ("a","b") && [column 2] = 5) || ([Column 1] = "c" and [column 2] = 6)

Atom

The below is exactly what i am trying to achieve, but getting this message: Parse Error at char (798): Unmatched (

 

I am not quite sure what is wrong....

 

([Cost Elem.] = "60517301" AND [Site] = "SKL" OR
[Cost Elem.] = "60512408" AND [Site] = "SKL" OR
[Cost Elem.] = "60512442" AND [Site] = "SKL" OR
[Cost Elem.] = "60517901" AND [Site] = "SKL" OR
[Cost Elem.] = "60517201" AND [Site] = "SKL" OR
[Cost Elem.] = "60516201" AND [Site] = "SKL" OR
[Cost Elem.] = "60516302" AND [Site] = "SKL" OR
[Cost Elem.] = "60516301" AND [Site] = "SKL" OR
[Cost Elem.] = "60512411" AND [Site] = "DR" OR
[Cost Elem.] = "60512411" AND [Site] = "LIT" OR
[Cost Elem.] = "60517301" AND [Site] = "LIT" OR
[Cost Elem.] = "60512410" AND [Site] = "LAP" OR
[Cost Elem.] = "60512411" AND [Site] = "LAP" OR
[Cost Elem.] = "60517301" AND [Site] = "LAP" OR
[Cost Elem.] = "60512408" AND [Site] = "LAP"

 

Quasar

The expression starts with "(" but there is no ending parenthesis.

Pulsar
Pulsar

Looks like some parens are missing.  Try this:

 

([Cost Elem.] = "60517301" AND [Site] = "SKL") OR
([Cost Elem.] = "60512408" AND [Site] = "SKL") OR
([Cost Elem.] = "60512442" AND [Site] = "SKL") OR
([Cost Elem.] = "60517901" AND [Site] = "SKL") OR
([Cost Elem.] = "60517201" AND [Site] = "SKL") OR
([Cost Elem.] = "60516201" AND [Site] = "SKL") OR
([Cost Elem.] = "60516302" AND [Site] = "SKL") OR
([Cost Elem.] = "60516301" AND [Site] = "SKL") OR
([Cost Elem.] = "60512411" AND [Site] = "DR" )OR
([Cost Elem.] = "60512411" AND [Site] = "LIT") OR
([Cost Elem.] = "60517301" AND [Site] = "LIT") OR
([Cost Elem.] = "60512410" AND [Site] = "LAP") OR
([Cost Elem.] = "60512411" AND [Site] = "LAP") OR
([Cost Elem.] = "60517301" AND [Site] = "LAP") OR
([Cost Elem.] = "60512408" AND [Site] = "LAP")

Quasar

I always think it helps to put distinct clauses in parenthesis as it helps me to understand what is intended. It looks like your expression could be written as

 

Re: Multicolumn filter and multiple possible answers (Alteryx Community Subscription Update)

([Cost Elem.] = "60517301" AND [Site] = "SKL") OR
([Cost Elem.] = "60512408" AND [Site] = "SKL") OR
([Cost Elem.] = "60512442" AND [Site] = "SKL") OR
([Cost Elem.] = "60517901" AND [Site] = "SKL") OR
([Cost Elem.] = "60517201" AND [Site] = "SKL") OR
([Cost Elem.] = "60516201" AND [Site] = "SKL") OR
([Cost Elem.] = "60516302" AND [Site] = "SKL") OR
([Cost Elem.] = "60516301" AND [Site] = "SKL") OR
([Cost Elem.] = "60512411" AND [Site] = "DR") OR
([Cost Elem.] = "60512411" AND [Site] = "LIT") OR
([Cost Elem.] = "60517301" AND [Site] = "LIT") OR
([Cost Elem.] = "60512410" AND [Site] = "LAP") OR
([Cost Elem.] = "60512411" AND [Site] = "LAP") OR
([Cost Elem.] = "60517301" AND [Site] = "LAP") OR
([Cost Elem.] = "60512408" AND [Site] = "LAP")

 

Also it could be simplified by using the IN operator - see above

Atom

i figured it out. It was because cost element is numerical field and for example "60517301" should be written as 60517301. thank you all for your help!

Labels