Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

SWITCH formula with Multiple Criteria

alphabex18
8 - Asteroid

Hi all, 

I have the below reference table that I need to build a conditional formula. I want to use a SWITCH statement, because its easier, but i don't know how to add in an "AND" statement to it. 

Should be "IF (Segment = DTP01) AND (Criteria = "382") then result would be "Group First Enrollment Date". then the next would be IF DTP01 and 007 would be "Group Policy Effective Date". 

If this cant be done in a SWITCH formula, then i can do a multiple IF statement, it just allows for so much error. I also tried the REPLACE tool, but couldn't figure out how to use 2 conditions

 

SegmentCriteriaColumn Header
DTP01382Group First Enrollment Date
DTP01007Group Policy Effective Date
DTP01301Member Qualifying Effective Date for COBRA
DTP01303RAF Effective Date
DTP01340COBRA Effective Date
DTP01356Member First Enrollment Date
DTP01357Member Termination Date
DTP01303Maintenance Effective Date
DTP01348Plan Effective Date
DTP01349Plan Termination Date
DTP01300Effective Date with Carrier - No Break in Coverage
2 REPLIES 2
danrh
13 - Pulsar

If you already have a reference table setup, I'd use a Text Input and a Join instead of a Switch statement --- this would be easier to read/manage.  But if your requirements for whatever reason require a switch, I'd suggest concatenating the two fields first and basing the results on that.  Something like:

 

Switch([Segment]+'|'+[Criteria],'',
	'DTP01|382','Group First Enrollment Date',
	'DTP01|007','Group Policy Effective Date')

Hope it helps!

alphabex18
8 - Asteroid

Actually, id like to build this as a text and join, so i don't have to write so many if statements. I am working on that now

Labels