I'm trying to subtract a column full of random dates - 12/31/2018. If the result < 366 then pick numbers from 'ST' and if > 366 then pick numbers from 'LT'. It would be great if someone can give me an idea on how to go with this.
Solved! Go to Solution.
Hi @Thableaus , my dates are in the following format.
IF your dates follow the same format as '12/31/2018' then I'd recommend this formula:
EDIT: Sorry, typo, change T for Y
- Use DateTimeParse function to change your date format to Alteryx format
- Use DateTimeDiff function to calculate difference from dates (in your case, subtract the dates)
Something like this:
IF DateTimeDiff(DateTimeParse([Date 1], "%m/%d/%Y"), '2018-12-31', "days") < 366 THEN [ST]
ELSE [LT] ENDIF
Cheers,
It seems they are in this format: 31-Dec-18
So, this function would fit:
IF DateTimeDiff(DateTimeParse([Date 1], "%d-%b-%y"), '2018-12-31', "days") < 366 THEN [ST]
ELSE [LT] ENDIF
Cheers,
Also, check this help document to understand how date parsing and specifiers work:
https://help.alteryx.com/10.1/Reference/DateTimeFunctions.htm
Cheers,
Thanks @Thableaus !