Want to Stop Rebuilding "Expensive" Parts of your Flow? Explicit Builds are the Answer!READ MORE

Getting errors in simple addition of column values

Solved!
wjkelly
Level 3
Getting errors in simple addition of column values

I've built a pivot which presents monthly customer purchases by brand (rows have customer ID, brand, then values for total $ purchase per month; columns are the months). The columns are of type "decimal".

I'm trying to build a new column which displays the total spend for six months by customer by brand. I'm trying use a simple column_1 + column_2 + ... + column_6 formula in the new column.

I'm getting strange results. For example, a row that features the values: 427.75, 913.0, 495.0, [no value], 150.0, 288.0 is returning the following result: 495.0913.0427.75.

Here's what the formula looks like in the Editor Panel:

 

Operating system used: MacOS Monterey v12.4


Operating system used: MacOS Monterey v12.4

0 Kudos
1 Solution
JordanB
Dataiker
Dataiker

Hi @wjkelly,

You should be able to achieve the output you’re looking for with the sum() method. I've included an example below for reference.

Screen Shot 2022-07-19 at 4.10.15 PM.png

In some cases, the ‘+’ operator can result in concatenation, for instance, if there are missing values in the columns that are being computed. Please see our knowledge base article Safe Sums across Columns in Dataiku DSS Formulas for more details on that.

Please let us know if you have any questions.

Thanks!

Jordan

View solution in original post

3 Replies
JordanB
Dataiker
Dataiker

Hi @wjkelly,

You should be able to achieve the output you’re looking for with the sum() method. I've included an example below for reference.

Screen Shot 2022-07-19 at 4.10.15 PM.png

In some cases, the ‘+’ operator can result in concatenation, for instance, if there are missing values in the columns that are being computed. Please see our knowledge base article Safe Sums across Columns in Dataiku DSS Formulas for more details on that.

Please let us know if you have any questions.

Thanks!

Jordan

wjkelly
Level 3
Author

Hi Jordan,

Thanks so much for this response. The sum([column_1,column_2 etc]) solution worked perfectly. And thanks too for the background info to help me understand why the "+" was not an ideal solution here.

 

JordanB
Dataiker
Dataiker

Hi @wjkelly,

Great! Glad we could help and thanks for keeping us posted.

Best,

Jordan

0 Kudos