Date formula
lolenmile
Registered Posts: 1 ✭✭✭
Hello dataikers,
I would like to know if one date is part of two distincts dates.
For example, if this date is superior to this date and inferior to this one, then put a 1 in the column or a 0 if it’s not.
I know that i have to use a IF function but it doesn’t seems to work !
Thank for your help
Tagged:
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,217 Dataiker
Hi,
As mentioned in this thread comparing data with < > is not directly supported.
You can use something like :
if(diff(date_column.asDate(), '2018-01-01'.asDate('yyyy-MM-dd'), 'seconds') < 0 , 1, 0) && if(diff(date_column.asDate(), '2017-01-01'.asDate('yyyy-MM-dd'), 'seconds') > 0 , 1, 0)
This would return True/False if the date is > 2017-01-01 and < 2018-01-01.
Let me know if this helps.