Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula

Hi2023
8 - Asteroid

Hi, 

 

I need help writing a formula :

 

I need it to say 

 

IF ResIND = I and STARTDATE is null then INITIAL and IF ResIND & STARTDATE is NOT NULL then RESTRICT

 

thankS!

3 REPLIES 3
binuacs
21 - Polaris

@Hi2023 

 

 

IF [ResIND] = 'I' And isNull([STARTDATE]) Then 'INITIAL'
ElseIf !isNull([ResIND]) And !isNull([STARTDATE]) then 'RESTRICT'
EndIF

 

 

DataNath
17 - Castor
17 - Castor

@Hi2023 assuming initial/restrict are flags, rather than fields (please correct me if not), this ought to be something like: 

 

 

IF [ResIND] = 'I' AND isNull([STARTDATE]) THEN "INITIAL"
ELSE "RESTRICT"
ENDIF

 

 

Unless you have more potential outcomes, then we'd need to use an elseif.

davidskaife
14 - Magnetar

Hi @Hi2023 

 

You have two options; if your only criteria is ResIND = I and StartDate is not null then you can do the below and all other records will be 'Restrict':

 

IF [ResIND] = "I" AND IsNull([STARTDATE])
THEN "Initial"
ELSE "Restrict"
ENDIF

 Another option to make it a bit more dynamic and account for other combination is below:

 

IF [ResIND] = "I" AND IsNull([STARTDATE])
THEN "Initial"
ELSEIF !IsNull([ResIND]) AND !IsNull([STARTDATE])
THEN "Restrict"
ELSE "Error"
ENDIF

I've added in a 'Error' clause which you can replace with whatever you want, but it will check both specific criteria and output error if it doesn't match either.

 

Hope this helps!

Labels
Top Solution Authors