How to do Nested IF conditions in DataIku
Hi Team,
I have a requirement like below to do a nested if condition. Let me know how to achieve this in DataIkU where I searched for few options but couldn't able to fully resolve.
IF
[Created Month] = [Rprt_Month] then 60 + (if [No. of buyer]>=6 then ([No. of buyer] -5) else 0 endif)*15
else
(IF [No. of buyer changed]>0 then [No. of buyer changed] * 15 ELSE 0 ENDIF) + (if [Deal Status] = "RENEW_STRUCTURING" THEN 30 else 0 endif)
endif
The above code is from Alteryx, I want to derive the similar solution from DataIku. Any help is much appreciated and thanks in advance.
Thanks
Operating system used: Windows
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,161 Neuron
Use the if() function in a formula processor in a Prepare recipe step. You can nest if() statements.
https://doc.dataiku.com/dss/12/formula/index.html#control-structures
https://knowledge.dataiku.com/latest/data-preparation/formulas/concept-formulas.html
Or use the Create if, then, else statements processor:
https://doc.dataiku.com/dss/latest/preparation/processors/create-if-then-else.html