Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need Help On Aggregation !!!!

Hi,

    Need Help On Aggregation i have input like

input:

PO NumberPO Line ItemAmt
100150
100145
100170
100290
100320

output:

PO NumberPO Line ItemAmtoutput
10015047.5
10014547.5
100170180
100290180
100320180

  The Logic is If PO Number and PO Line Item Both are like previous records We have to do the AVG and

   if PO Number and  PO line item different like previous record we have to do the SUM Of those records as showcase in the Output table

Here am attaching the sample data please help me

In attach file have 2 sheets Sheet1 is input and Sheet2 Is Output

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

I don't understand your logic.

On line 1 I see PO Number 100 and PO Line Item 1. There are no previous rows, i.e. there is no line 0. So what applies here to this line, sum or avg?

On line 3 I see PO Number 100 and PO Line Item 1. Those are the same values as on the previous row. So according to your logic avg should be applied. But your result uses sum instead.

This doesn't make sense.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi ,

  Thanks For rly,

            If  see above output table  3 PO Number and PO Line Item Has been repeated

              here the logic is first 2 rows need to be in Average and 3 row which is starting as sequential need to be in sum

              please help me in this

Thanks

Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand