Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Multiple criteria in one formula

nrubner1
7 - Meteor

How do I set up my formula to have multiple options as the criteria?

 

For example, my current formula would be something like (Contains([Food], "Fruit") OR (Contains([Food], "Chocolate") OR (Contains([Food], "Pizza"). I believe there is a shortcut to present ((Contains([Food], "Fruit"/"Chocolate"/"Pizza") in one go - is that possible?

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@nrubner1,

 

While there isn't a way to construct the formula as you described it, I did create a macro (Contains In-List) that does exactly that.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
nrubner1
7 - Meteor

Hi Mark,

 

Thanks for your reply. This macro looks really interesting, but I'm not exactly sure which control parameter I would use and how I would configure it to solve my query. Could you give me any pointers?

 

Thanks,

 

Natalie

BenMoss
ACE Emeritus
ACE Emeritus
Hi!

I'm going to propose a different solution to Mark which would be to use the 'find and replace tool'.

I would create a text input with two columns, the first would contain a row by row list of the values I want to search for. The second column would contain a flag 'Y'.

You can then use the find and replace tool to search for the words in this lookup list, against a field in your main data stream; you can choose the 'append a field' option and choose the flag field, which means the stream coming out of the tool would contain all your original values, plus an additional field, 'flag' which would contain a Y If any of the values exist, or be empty if non exist.

Have a go at implementing this logic and I'll give you some help if you struggle.

Ben
BlakeB
Alteryx
Alteryx

Hi @nrubner1, I saw this achieved on a session with a customer the other day. 

 

You can try using the IN() formula, with your multiple criteria inside the parenthesis e.g. [Food] IN ("Pizza", "Chocolate", "Fruit")

 

See my attached workflow and let me know if this works. 

Labels