3 Replies Latest reply: Apr 1, 2014 7:07 AM by AAA AAA

sum according to another column

Hello,Everybody,I'm a new fish here,

Latest I got a problem and hopes for everyone's help

In QlikView, I've got a random table like this

--------------------------------------------------------------------

COLUMN1       COLUMN2          COLUMN3

A                     10

A                     20

A                     30

B                     20

B                     5

B                     25

C                     10

C                     12

C                     22

----------------------------------------------------------------------

Now I want to account for result like this:

----------------------------------------------------------------------

COLUMN1        COLUMN2           COLUMN3

A                     10                       10

A                     20                       30

A                     30                       60

B                     20                       20

B                     5                         25

B                     25                       50

C                     10                       10

C                     12                       22

C                     22                       44

----------------------------------------------------------------------

So how can I do to solve this problem.

• Re: sum according to another column

Create a straight table

Dimension =

Column1

Column2

Expression

RangeSum(Above(SUM(COLUMN2),0,RowNo()))

UPDATE : You can do the same at script level

Temp:

[

COLUMN1, COLUMN2

A,       10

A,          20

A,          30

B,          20

B,           5

B,          25

C,          10

C,          12

C,          22

];

NoConcatenate

Final:

COLUMN1,

COLUMN2,

IF(COLUMN1 = PEEK('COLUMN1'), RangeSum(Peek('COLUMN3'),COLUMN2), COLUMN2) as COLUMN3

Resident Temp

Order By COLUMN1;

Drop Table Temp;

• Re: sum according to another column

Can you please write the script in details?Best write a part of critical scripts thanks

• Re: sum according to another column

Thank you very much for your help~