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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Commulative Sum

Hi Guys,

Need your help again.

Please see my table below:

PO NOITEM NOQTY
PO-10001ITEM-0110
PO-10002ITEM-01

15

PO-10003ITEM-0220
PO-10004ITEM-0210


Output Table:

PO NOITEM NOQTYQTY Commulative
PO-10001ITEM-011010
PO-10002ITEM-011525
PO-10003ITEM-022020
PO-10004ITEM-021010

QTY Commulative is the Commulative Sum of QTY group by ITEM NO.

Thank you..

~skip~

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hey Skip,

Here's one way of sorting it out using Peek() to determine when the ITEMNO value changes:

Load

          PONO,

          ITEMNO,

          QTY,

          if(peek('ITEMNO')<>ITEMNO, QTY, peek('QTY_Cumulative')+QTY) as QTY_Cumulative;

LOAD * INLINE [

    PONO, ITEMNO, QTY

    PO-10001, ITEM-01, 10

    PO-10002, ITEM-01, 15

    PO-10003, ITEM-02, 20

    PO-10004, ITEM-02, 10

];

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hey Skip,

Here's one way of sorting it out using Peek() to determine when the ITEMNO value changes:

Load

          PONO,

          ITEMNO,

          QTY,

          if(peek('ITEMNO')<>ITEMNO, QTY, peek('QTY_Cumulative')+QTY) as QTY_Cumulative;

LOAD * INLINE [

    PONO, ITEMNO, QTY

    PO-10001, ITEM-01, 10

    PO-10002, ITEM-01, 15

    PO-10003, ITEM-02, 20

    PO-10004, ITEM-02, 10

];

Not applicable
Author

Hi Johannes,

Thank you very much, simply and exactly what I need.

Regards,

~skip~