Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
Master
Master

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

?

View solution in original post

4 Replies
BrunPierre
Master
Master

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
Champion

Inaddition to  

 

 

Sunil Chauhan