Date formula

Options
lolenmile
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

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,209 Dataiker
    edited July 17
    Options

    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.

    Screenshot 2021-06-09 at 10.37.25.png

    Let me know if this helps.

Setup Info
    Tags
      Help me…