Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I subtract or add the values within rows in the data load editor?
For example:
A | B |
1 | 10.000 |
2 | 2.500 |
I would like to subtract 10.000 -/- 2.500 and then, add this value to row 3.
A | B |
3 | 7.500 |
Thanks in advance!
Try using the Previous() function. Make sure the load sorts the table correctly.
HI @mvs01
Try like this..
Temp:
LOAD * INLINE [
A, B
1, 10.000
2, 2.500
];
Concatenate
LOAD * where not IsNull(A);
Load Previous(A)+A as A, Previous(B)-B as B Resident Temp;
Am not sure, what is ur exact requirement?
Thanks everyone for the reply, now I can ask my question better. My requirement is as follows (another example).
I'm having this data:
A | B |
1 | 10000 |
2 | 2500 |
3 | 7500 |
4 | 3000 |
I would like to subtract the value where A = 1 with the value where A = 4 and then add the new value to a new row. Like this: row A = 5 and value = 10.000 -/- 3.000 = 7.000.
I found a workaround so far:
Temp:
LOAD * INLINE [
A, B
1, 10.000
2, 2.500
3, 7.500
4, 3.000
];
Concatenate:
LOAD
5 as A
- sum(If(A=1, B)) - sum(If(A=4, B)) as B
Resident Temp
Group By A;
Is this the way you would do? Any feedback would be welcome!
Thanks again!