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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
okin_pfa
Contributor II
Contributor II

Sum of only negative values

Hi,

Can somebody help me to sum only negative values ?

In first two columns  I have [Stock Qty] and [Backorders Total] . Third, blue column rba is difference of the [Stock Qty] and [Backorders Total].
I would like to sum only negative values of rba and in total row to sum it per ItemNo which is my second dimension in Table.

Labels (2)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master II
Partner - Master II

Sum({<Customer={"=Sum([Stock Qty] -[Backorders Total])<0"}>}[Stock Qty] -[Backorders Total])

?

View solution in original post

4 Replies
BrunPierre
Partner - Master II
Partner - Master II

Sum({<Customer={"=Sum([Stock Qty] -[Backorders Total])<0"}>}[Stock Qty] -[Backorders Total])

?

MarcoWedel

Sum(RangeMin([Stock Qty]-[Backorders Total],0))
robert99
Specialist III
Specialist III

Hi @okin_pfa 

Im not sure exactly what you want. 

I would like to sum only negative values of rba.

By PartNo or by Customer . I assume by PartNum (as you have used PartNo in your 4th column)? Or by both or just Customer but also gives the correct total by PartNo

And have tried if instead of Set Analysis. 

sum(aggr(

if(Sum(rbo)<0,sum(rbo),0)

,Customer,ItemNo)) //Or just ItemNo or Customer. By Customer should give you the correct total as per the blue column

 

SunilChauhan
Champion II
Champion II

Inaddition to  

 

 

Sunil Chauhan