Minus date by 4 months, and plus 1
Hi dataiku community, can you help me with this problem
I have a date column where it is always a month end. for example 2025-11-30 or 2026-01-31
and now i want to minus that date by 4 months, and add 1 day to it.
so if the date is 2025-11-30 it will be 2025-08-01
if the date is 2026-01-31 it will be 2025-10-01
does anyone have solutions for this? thank you.
Operating system used: Windows
Operating system used: Windows
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,644 NeuronHi, the solution will depend on what data type the column is on. If it is a proper date you can use a Prepare recipe and use the Formula language function inc() to add or remove units of time:
If it is not a date you will first need to use asDateOnly() to convert your string to a date. Then do your date changes and finally convert back to your using datePart().