multiply

David_Mellamphy
Level 2
multiply

Hi - I have a very simple request but I am unable to work it out. 

I have 2 columns on a dataset which I need to multiply one by the other? 

Example one column is in USD and then I have a rates column and I want to multiply one by the other to give a number?

0 Kudos
2 Replies
max
Dataiker

Hello @David_Mellamphy,

In a prepare recipe, you can add a new "Formula" preprocessor. If one column is named "cost" and the other is "rate", your formula would look something like 

cost * rate

and the result will be in whatever "Output column" is set to.

I hope this helps,

Max

me2
Level 3

You can do it several ways including using SQL, Python, R, Visual Recipe, etc.

Using a Prepare Visual Recipe:

  1. Add new step, "Formula" from the Processor Library
  2. Set the formula to numval("dollars")*numval("rate").  Numval() tells dataiku to use the number value of that row from column "x".

You might have to do some pre-processing if some rows have null values or storage type is not an integer/double . 

Have fun!