Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
roee1983
Contributor III
Contributor III

Presenting Negetive Values


Hi all,

How can I ignore negative values ?

I have a table with next values

Table A:

pro1,15

pro2,30

pro3,-40

How can I prevent showing the negative record?

thanks

Roee

Labels (1)
26 Replies
v_iyyappan
Specialist
Specialist

Hi,

U can do both script and design

Script:

Load

     column1,

     if(column2 > 0, column2) AS column2

From table;

Design

=Sum({<column2 = {">0"}>}column2)

Regards,

Not applicable

Hi,

PFA,

marcel_olmo
Partner Ambassador
Partner Ambassador

I don't know if you want to read the value but prevent showing that value in Qlikview, or if you just want to ignore negative values while you're reading the table.

Case 1 : You only want to load the table without negative values :

Table A:

A,     B

pro1,  15

pro2,  30

pro3,  -40

you only have to add "where num(B) >=0";

Case 2 : You only want to show positive values :

You have to use in your charts the function rangemax() like this :

rangemax(0,B), it will return B if it is positive, or 0 if it is negative.

Hope that helps!

Regards, Marcel.

ThornOfCrowns
Specialist II
Specialist II

I don't think you can do this with a Table Box, can you use a Straight Table instead? If so, an expression of:  

=if([Value]>=0,[Value])
will filter your data.

jarno_loubser
Partner - Creator
Partner - Creator

3 options I can think of:

  1. Filter the negative rows out as part of the load script (load project,amount from file.txt (txt) where amount >= 0)
  2. Create a separate field in the resident tale in the load script and use the new field for expressions (load project,amount, if(amount <0,0,amount) as amount_to_sum from file.txt (txt))
  3. Load the data as is and do the calculation on the front end using an "IF" statement. (load project,amount from file.txt (txt) ----then --- sum( if(amount <0,0,amount)  on the front end)

Option 1 will be the fastest on the front end, but you can only use this method if you NEVER will need the negative values in your model.

Option 2 will be slower then option 1 but faster that option 3 on the front end.

Hope that helps!

Anonymous
Not applicable

try this one get the output

if(ALT(SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))*-1, 0)<0,ALT(SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))*-1))

Anonymous
Not applicable

Hi

try this one

if(ALT(SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))*-1, 0)<0,ALT(SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))*-1))