Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi , I would like to create a new column of data (i.e. column c) whereby if col A does not contain the word "number", then col C = Col B*10 and if not , col C = Col B
So for example, the first row in col A contains the word number , so col C = col B(i.e. 10) ; while the second row does not contain the word "number", so Col C = col B * 10 (20* 10= 200)
|Col A||Col B||Col C (would like to generate this col)|
|Number of XX||10||10|
|Amount of YY||20||200|
You can create such a column C in a Prepare recipe, by adding a Formula step.
In your case, the formula would be:
if(contains(toLowercase(A), "number"), B, B*10)
I used toLowercase to ensure that the if is case insensitive, i.e. for instance Number and number within the A column would yield the same result for C.
You can learn more about the Formula language in the documentation: https://doc.dataiku.com/dss/latest/formula/index.html
Hope this helps 😊
You might want to use an or operator here (refer to the Formula documentation: https://doc.dataiku.com/dss/latest/formula/index.html#boolean-functions).
This would be something like the following:
if(contains(toLowercase(A), "number") || contains(toLowercase(A), "a."), B, B*10)