Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Multicolumn filter and multiple possible answers

MichalJ
5 - 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

7 REPLIES 7
haroon_sa
10 - Fireball

Hi @MichalJ

 

Check out this solution. Hope it helps.

FILTER11.PNG

ivoller
12 - 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)

MichalJ
5 - 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"

 

ivoller
12 - Quasar

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

mbarone
16 - Nebula
16 - Nebula

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")

ivoller
12 - 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

MichalJ
5 - 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