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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
irmantas
Contributor III
Contributor III

SUM with IF

Hi all,

I have two tables without a shared key.

     

ProductIdSalesQty
X5
Y2
Z6

 

InventIdStockQty
X100
Y50

In Pivot I want show sum of SalesQTY and sum of StackQTY. Were ProducId = InventId.

sum({ <ProductId=InventId>} StockQty) is not working.

26 Replies
irmantas
Contributor III
Contributor III
Author

Something wrong. SUM StockQTY rising up in every row.

shiveshsingh
Master
Master

Check if full accumulation is off in chart properties.

prma7799
Master III
Master III

try this

aggr(Distinct sum(if(InventId=ProductId,(StockQTY))),InventId)


or


aggr(Distinct sum(if(InventId=ProductId,(StockQTY))),InventId,ProductId)

irmantas
Contributor III
Contributor III
Author

"No accumulation" helps, do not rising up. But still sum of StockQTY is wrong:

shiveshsingh
Master
Master

Which expression are you using?

irmantas
Contributor III
Contributor III
Author

aggr(Distinct sum(if(InventId=ProductId,(StockQTY))),ProductId)

PrashantSangle

If possible share your app..

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂