Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have the following data:
Name X1 X2
John 3 1
Alex 2 2
Sara - 5
I need to make another LOAD in order to get new table with SUM, so the result table should be:
Name X1 X2 SUM
John 3 1 4
Alex 2 2 4
Sara - 5 5
I try the code like this:
LOAD
Name,
X1,
X2,
X1 + X2 AS SUM
RESIDENT Table 1;
As the result, for Sara I got SUM result equel to -.
How can I modify the code in order to make summation correctly?
P.S.: I have about 10 arguments to be summed
Thank you in advance!
Just use:
rangesum(X1, X2) AS SUM
- Marcus
NULL plus any value equals NULL. Use IF and ISNULL function.
I did it before, but know I have about 10 arguments ... to complex with IF using in script
rangesum works perfect.
Thank you!
Another simple solution:
Alt(X1,0) + X2 AS SUM
Didn't know. Thank you, this one is even better!