Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
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)

2 REPLIES 2
apathetichell
18 - Pollux

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
13 - Pulsar

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