Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
When I try to make arithmetic operations with values in rows result is calculated only in rows where exist every part of expression. Here is example
sample:
load * inline [
ID, T1, T2
1, 1, 1
2, , 1
3, 1, 1
4, 1,
]
;
Left Join (sample)
LOAD
ID,
T1+T2 as SUM
Resident sample
;
Result is
How can calculate sum for every row? So, for ID 2 and 4 it should be 1
Instead of
.....
T1+T2 as SUM
try like:
RangeSum(T1, T2) as SUM
Try this.
sample:
LOAD ID,If(T1='',0,T1) as T1,If(T2='',0,T2) as T2;
load * inline [
ID, T1, T2
1, 1, 1
2, , 1
3, 1, 1
4, 1,
];
Left Join (sample)
LOAD
ID,
T1+T2 as SUM
Resident sample
;
It works. Thanks