Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
How we can calculate -ve and +ve values in 2 columns.
e.g. A B C
5 10 5
5 3 -2
100 170 70
100 30 -70
201 501 300
o/p
A D E
5 5 -2
100 70 -70
201 300 -
Thanks,
Ravi
See attached qvw.
I liked Gysbert's soloution, however FYI: just an other soloution if you want, please check below script
//---------------------------------------------------------------------------------
Data_Temp:
LOAD * INLINE [
A, B, C
5, 10, 5
5, 3, -2
100, 170, 70
100, 30, -70
201, 501, 300
];
//---------------------------------------------------------------------------------
Map_Data_D:
Mapping LOAD A, C Resident Data_Temp Where C>=0;
Map_Data_E:
Mapping LOAD A, C Resident Data_Temp Where C<0;
//---------------------------------------------------------------------------------
Data:
Load
A,
ApplyMap('Map_Data_D',A,'') as D,
ApplyMap('Map_Data_E',A,'') as E
Resident Data_Temp;
DROP Table Data_Temp;
//---------------------------------------------------------------------------------
PFA
Can you explain how the if(mod(RowNo(),2,C) and if(not mode(RowNo(),2,C) function works to split out column c?
Would this work if the data was like below?
LOAD *
INLINE [
A, B, C
5, 10, 5
5, 3, -2
5, 4, -3
100, 170, 70
100, 30, -70
201, 501, 300
];