IF THEN Formula - Alteryx to Dataiku

Solved!
FarSideFeb
Level 3
IF THEN Formula - Alteryx to Dataiku

Good afternoon,

In Alteryx I would write a formula such as: 
         IF [PYMT_PAID_AMT]=0 THEN Null() ELSE [PYMT_PAID_DESC] ENDIF

I don't understand how to replicate this in Dataiku, as Dataiku recognizes that same formula as invalid, having "unknown tokens". I tried reading the documentation page, but didn't see anything helpful while scrolling through. Is there anywhere that provides examples/comparison of how to write formulas from Alteryx to Dataiku?


Operating system used: Windows

0 Kudos
1 Solution
AlexT
Dataiker

Hi @FarSideFeb 

To use a similar  formula " IF Contains([ORDER_STS_DESC],"Cancelled") THEN "Cancelled" ELSE "" ENDIF" in DSS you can write something like :

You don't really need more than 3 processors here since you have the condition and if true and if false e.g Cancelled and "". If you need to perform nested ifs 


if(contains(ORDER_STS_DESC, "Cancelled"), "Cancelled", "")  

 

Below is generic example with CHERRY in the Description column, if you want to replace or create a new column you can select output column. 

Screenshot 2022-07-19 at 17.08.54.png

Let me know if that helps

View solution in original post

3 Replies
AlexT
Dataiker

Hi,

DSS formula equivalent would be :

if(PYMT_PAID_AMT == 0, "", PYMT_PAID_DESC) 

You can have a look at the documentation here : https://doc.dataiku.com/dss/latest/formula/index.html

Also very useful to when writting a formula to use the "Open Editor" panel in the Prepare recipe which will help with the syntax e.g Screenshot 2022-07-06 at 22.41.39.png

Let me know if that helps!

FarSideFeb
Level 3
Author

Thank you @AlexT !

I did open up the editor; however, the comments it gave were not helpful. I do have one more formula question.

In Alteryx I have the formula: IF Contains([ORDER_STS_DESC],"Cancelled") THEN "Cancelled" ELSE "" ENDIF

I tried to mimick the formula example you gave above; however, that did not work as the editor only accepts 3 arguments. How would I recrate this if then formula in Dataiku?

0 Kudos
AlexT
Dataiker

Hi @FarSideFeb 

To use a similar  formula " IF Contains([ORDER_STS_DESC],"Cancelled") THEN "Cancelled" ELSE "" ENDIF" in DSS you can write something like :

You don't really need more than 3 processors here since you have the condition and if true and if false e.g Cancelled and "". If you need to perform nested ifs 


if(contains(ORDER_STS_DESC, "Cancelled"), "Cancelled", "")  

 

Below is generic example with CHERRY in the Description column, if you want to replace or create a new column you can select output column. 

Screenshot 2022-07-19 at 17.08.54.png

Let me know if that helps