Alteryx Designer Desktop Discussions

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

Error in If statement

MB_Rocks
7 - Meteor

if contains(Month,"February") and if contains(Year,"2020") then "02-01-2020"
elseif contains(Month,"February") and if contains(Year,"2021") then "02-01-2021"
end

This is I'm using in multi row formula option 

Plse help me with the code 

 

It resolved Thanks Team 

1 REPLY 1
mbarone
16 - Nebula
16 - Nebula

if contains(Month,"February") and if contains(Year,"2020") then "02-01-2020"
elseif contains(Month,"February") and if contains(Year,"2021") then "02-01-2021"
end

 

I tend to use boolean instead of if/then/else.  So here's how I'd do it:

IIF(Contains([Month],'February') && Contains([Year],'2020'),'02-01-2020',

IIF(Contains([Month],'February') && Contains([Year],'2021'),'02-01-2021',

Null() ))

 

That can easily be translated to if/then/else, but I think what you're missing is the final condition where both your IF statements fail.

Labels