Comparing a Date column with the result of an "inc" formula
![JBaesen](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar20.png)
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
Best Answer
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,211 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")
Answers
-
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 !