Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
irmantas
Contributor III
Contributor III

Aggr with sum - something wrong

Hi,

sum(aggr(NODISTINCT sum({1<TransType = {2} >} QTY),TransRefId))

Working fine while only 1 line in range with the same TRANSTYPE + TransRefId, but if we have more than 1 line - something wrong.

In ex. is 3 lines with the same TransType and TransRefId and result of sum is 9??? must be 3

     

ItemIdDatePhysicalQtyTransTypeTransRefId
JE-90118002018.07.0332gu074031
JE-90118002018.07.03-32gu074031
JE-90118002018.07.0332gu074031
PA-GR-KV-PASA-00-022018.07.03-1,1721gu074031
PA-GR-KT-KUKU-00-032018.07.03-0,7521gu074031
PA-GR-KT-KUKU-00-032018.07.03-0,0031gu074031
PA-04-SAR-00-0-00-012018.07.03-0,0061gu074031
PA-04-SAR-00-0-00-012018.07.03-0,3641gu074031
PA-04-SAR-00-0-00-012018.07.03-0,0011gu074031
PA-03-SAU-00-0-99-022018.07.03-23,91gu074031
PA-03-SAU-00-0-99-022018.07.03-156,11gu074031
PA-06-RUG-00-0-00-012018.07.03-0,1491gu074031
PA-14-MIE-00-0-09-072018.07.03-0,091gu074031
PA-14-MIE-00-0-09-072018.07.03-0,0031gu074031
PA-04-KOK-00-0-99-012018.07.03-0,0251gu074031
PA-04-RIE-00-50-012018.07.03-451gu074031
PA-04-KAN-00-0-99-022018.07.03-0,0541gu074031
PA-04-KAN-00-0-99-022018.07.03-0,0031gu074031
PA-08-CIB-00-0-99-012018.07.03-61gu074031
PA-08-CIB-00-0-99-012018.07.0361gu074031
PA-12-NAC-00-0-50-012018.07.03-0,0151gu074031
PA-GR-KT-ZIRN-00-032018.07.03-0,151gu074031
Z-GPS-PRIEM2018.07.03-31gu074031
Z-GPS-SMULK2018.07.03-31gu074031
Z-GPS-ATKRO2018.07.03-31gu074031
Z-GPS-GRANU2018.07.03-31gu074031
11 Replies
irmantas
Contributor III
Contributor III
Author

Maybe I must write all needs:

I have Invettrans table, were are all items transactions as you can see in my first post.

I need by selecting ItemId (TransType - "1") to find SUM of Item QTY, and in other field - SUM of all trans with TransType is "2" and TransRefId is the same as range by selected ItemId

irmantas
Contributor III
Contributor III
Author

Finally, Thank you Stefan - working:)