multiply

Options
David_Mellamphy
David_Mellamphy Registered Posts: 9

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?

Answers

  • max
    max Dataiker Posts: 8 Dataiker
    Options

    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
    me2 Registered Posts: 48 ✭✭✭✭✭
    Options

    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!

Setup Info
    Tags
      Help me…