Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jorgen_santberg
Contributor III
Contributor III

Sum of partial sums

Hi,

I want to get the negative margin of the credit note like in the table below.

OrdnoArtnoSalesMargin
1234111110050
12341111-100-75
1234222220080
12342222-200-90
567811115030
5678222210040
56783333800100

The outcome I want is the sum of the margin on orders where the sum of sales = 0 (so in this example Ordno 1234). The outcome in this case should be -35, but when I use Sum({<Sales={0}>} Margin) I get no result.

Can somebody help me?

4 Replies
sunny_talwar

Try this

Sum({<Ordno = {"=Sum(Sales) = 0"}>}Margin)

jorgen_santberg
Contributor III
Contributor III
Author

Hi Sunny,

No this doesn't work.

sunny_talwar

Working for me

Capture.PNG

shiveshsingh
Master
Master

yep, this expression is working as required.

=sum({<Ordno={"=Sum(Sales)=0"}>}Margin)