This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I have fixed your IF statement and the workflow is attached. You have to be careful when dealing with dates in Alteryx as they have to be in a certain format and you must use the functions available in the formula tool to manipulate the data in the way you need. A few key things to note:
DateTimeParse(<date>,<format>) - you need to use this to inform Alteryx that the string value "01-01-2019" needs to be treated as a date and what the particular date format is. Check here for Date Format syntax.
DateTimeDiff(dt1,dt2,'years') - to find the difference between dates.
In an IF statement, you shouldn't refer to the field - it should read 'THEN 5' not 'THEN [FieldName] = 5'
If [End date] < DateTimeParse("01-01-2019",'%d-%m-%Y')
ElseIf [End date] = ""
ElseIf [End date] > DateTimeParse("01-01-2119",'%d-%m-%Y')
If [Start Date] > DateTimeParse("01-01-2019",'%d-%m-%Y')
DateTimeDiff([End date],[Start Date],'years')
DateTimeDiff([End date], DateTimeParse("01-01-2019",'%d-%m-%Y'),'years')