Hi All,
I have a problem in handling Nested If statement and I don't understand why is not working.
I am afraid that problem occurs because of date format.
Could you please help me with this?
Solved! Go to Solution.
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:
If [End date] < DateTimeParse("01-01-2019",'%d-%m-%Y')
Then 5
ElseIf [End date] = ""
Then
5
ElseIf [End date] > DateTimeParse("01-01-2119",'%d-%m-%Y')
Then
5
Else
If [Start Date] > DateTimeParse("01-01-2019",'%d-%m-%Y')
Then
DateTimeDiff([End date],[Start Date],'years')
Else
DateTimeDiff([End date], DateTimeParse("01-01-2019",'%d-%m-%Y'),'years')
EndIf
EndIf
Hope this helps. Please refer to to the help documentation - https://help.alteryx.com/current/Reference/Functions.htm?Highlight=datetimeformat - if you need some more information on some of these DateTime functions. Let us know if you have any more questions or need any more help.
Best,
Luke