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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
layanmahendra
Contributor
Contributor

Aggr and count

Hi experts,

I used following formula to calculate Remaining Qty for orders. This has values both minus and plus. Now I need to calculate how many minus values per order. How to do such? Please forward your Ideas 

($(wip1)+$(wip2)+$(RM_Stock)+ $(IN_Tran_WIP)-(sum(
aggr( nodistinct
rangesum(
above(
total sum({1}QTY_REQUIRED),0,RowNo()
)
)
,RPART_NO ,(ORDER_NO,( LOAD_ORDER,ASCENDING))
)
)-QTY_REQUIRED) )- QTY_REQUIRED 

Labels (8)
3 Replies
Gabbar
Specialist
Specialist

For Example You have a field , FieldA which you are calculating,
now if you want only those where fieldA is negative you can add:
fieldA={"<0"} 
in the set expression.

layanmahendra
Contributor
Contributor
Author

RPART                      QTY             PRIORITY_CAT                   YEAR                  RESULT_QTY

A                                    3                          4                                        2022                           0

A                                   10                     10                                        2022                         3

A                                    15                     5                                          2023                         18

A                                    20                     10                                       2023                          38    

A                                      5                       33                                      2023                         43

 

Data has sorted to Priority_category and Year already. Output like be this. I need load script to get this RESULT_QTY

Gabbar
Specialist
Specialist

Can you tell the business logic to create RESULT_QTY.