ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

Formula for valid building if then statement

lynettejackson
7 - Meteor

I am unable to get the valid building rooms with the Contain statement. I am looking for 48A,48B,48C,48U,77,87,87B,98A,98B is valid else invalid type statement.

 

Contains([OS: Building],48A,48B,48C,48U,77,87,87B,98A,98B)

apathetichell
13 - Pulsar

those are strings. try:

if [Building] in ("48A","48B","48C","48U","77","87","87B","98A","98B") then "valid" else "invalid" endif

 

In  your case the full logic is probably

formula tool - new column Valid

if [Building] in ("48A","48B","48C","48U","77","87","87B","98A","98B") then "valid" else "invalid" endif

 

Contains is also 1 argument compared to 1 argument. In - looks at a full list.

 

hellyars
12 - Quasar

Here is a slightly different approach.  This uses an input table and a join to filter the valid buildings, etc.  @apathetichell 's approach is simpler and spot-on.  The approach depicted here might be useful if you expect the list to change or significantly expand. 

 

Screen Shot 2021-05-04 at 6.50.46 PM.png

Labels