Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Splitting of -ve and +ve values in 2 columns

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

4 Replies
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

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;

//---------------------------------------------------------------------------------

Not applicable
Author

PFA

michael_gardner
Creator III
Creator III

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

];