Comparing a Date column with the result of an "inc" formula

Solved!
JBaesen
Level 1
Comparing a Date column with the result of an "inc" formula

Hi !

I'm trying to flag rows using a formula comparing a date column with the result of an "inc" function. While the documentation states that "The comparison operators (and only them) can operate on dates.", my formula does not get me any result although it is correct.

DATSAI >= inc(DATE_CALCUL,-1,"year").

The only way I found around it is creating a new column containing the result of my "inc" function but it requires me to create a column everytime I want to add or cut from my date...

Can you help me use the inc function in the formula please ?

Thank you in advance

 

 

0 Kudos
1 Solution
AlexT
Dataiker

Hi @JBaesen ,
Have you tried to wrap that with asDate? 
https://doc.dataiku.com/dss/latest/formula/index.html#avoiding-auto-typing


asDate(order_date) >= inc(order_date,-1,"years")

Screenshot 2023-06-03 at 3.54.47 PM.png

View solution in original post

0 Kudos
2 Replies
AlexT
Dataiker

Hi @JBaesen ,
Have you tried to wrap that with asDate? 
https://doc.dataiku.com/dss/latest/formula/index.html#avoiding-auto-typing


asDate(order_date) >= inc(order_date,-1,"years")

Screenshot 2023-06-03 at 3.54.47 PM.png

0 Kudos
JBaesen
Level 1
Author

Hi @AlexT ,

Thanks for your answer, worked like a charm ! ๐Ÿ™‚

Hadn't thought about it because my column was already a date but as long as it works !

0 Kudos