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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bellesol
Creator
Creator

Aggr Sum

Hi,

I have the following table:

ProductOrderIDTypeOrderSum$
A11100
A11200
A21500
B41600
B42100
B51800

 

I would like to calculate the sum of "OrderSum$" group by "OrderID" which the sum of the order is bigger then 400$ and the type of the order is 1 and display it by "product" -

for example: Product "A" has 2 orders the sum of orderID "1" is 300$ and the sum of orderID "2" is 500$, so only orderID ="2" should be displayed because the sum of the order is bigger then 400$

the final table should look like:

ProductOrderSum$
A500
B1400

 

I attached QVW for example.

 

2 Solutions

Accepted Solutions
sunny_talwar

Try this

Sum(Aggr(
  If(Sum([OrderSum$]) >= 500, Sum([OrderSum$]))
, Product, OrderID))

View solution in original post

lironbaram
Partner - Master III
Partner - Master III

hi 

this expressions should work for you 

sum(aggr(if(sum({<Type={"1"}>}OrderSum$)>400,sum({<Type={"1"}>}OrderSum$)),OrderID,Product))

View solution in original post

3 Replies
sunny_talwar

Try this

Sum(Aggr(
  If(Sum([OrderSum$]) >= 500, Sum([OrderSum$]))
, Product, OrderID))
lironbaram
Partner - Master III
Partner - Master III

hi 

this expressions should work for you 

sum(aggr(if(sum({<Type={"1"}>}OrderSum$)>400,sum({<Type={"1"}>}OrderSum$)),OrderID,Product))
bellesol
Creator
Creator
Author

Thank you all!