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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum only if positive

Hello,

I'm working with a table that has total order and total received. i created a calculated expression "total order - total received = open order".

However, there may be instances where the result is negative. how can i exclude negative values from my pivot table?

Thanks,

Sara

Labels (1)
1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Perhaps something like this?

sum(rangemax(0,"total order"-"total received"))

Or this?

sum(if("total order"-"total received">=0,"total order"-"total received"))

But for higher chart performance, you could instead do the if() in the script:

if("total order"-"total received">=0,"total order"-"total received") as "positive open order"

Then just sum("positive open order") in the chart.

Other approaches are possible as well.

View solution in original post

1 Reply
johnw
Champion III
Champion III

Perhaps something like this?

sum(rangemax(0,"total order"-"total received"))

Or this?

sum(if("total order"-"total received">=0,"total order"-"total received"))

But for higher chart performance, you could instead do the if() in the script:

if("total order"-"total received">=0,"total order"-"total received") as "positive open order"

Then just sum("positive open order") in the chart.

Other approaches are possible as well.