# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

#### Breathe easy -- you now have more time to plan your next steps with Qlik! QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

I need to do a cumulative sum in the resident table as follows

tab1

a, b, c, d

a, 201101, 1, 0

a, 201101, 1, 1

a, 201102, 1, 1

b, 201101, 1, 0

b, 201102, 1, 1

c, 201101, 1, 0

c, 201102, 1, 0

result

a, b, c, d, e, f

a, 201101, 1, 0, 1, 0

a, 201101, 1, 1, 2, 1

a, 201102, 1, 1, 3, 2

b, 201101, 1, 0, 1, 0

b, 201102, 1, 1, 2, 1

c, 201101, 1, 0, 1, 0

c, 201102, 1, 0, 2, 0

1 Solution

Accepted Solutions
Not applicable

## Re: Cumulative Sum in Load

Hi Robson,

You can see the attached example.

I hope is what you want.

Best regards.

3 Replies
MVP

## Re: Cumulative Sum in Load

Ri Robson,

I think it could look like this

if(peek(a) =a, peek(e)+c,c) as e,

if(peek(a) =a, peek(f)+d,d) as f

resident tab1 order by a ASC, b ASC;

i.e. order your Input table by a, b ascending (like in your example, but force it).

Check if first column value is identical to previous value, then sum up, else (first appearance of value) start with initial value.

I hope I understood your requirement,

Stefan

Not applicable

## Re: Cumulative Sum in Load

Hi Robson,

You can see the attached example.

I hope is what you want.

Best regards.

Not applicable

## Re: Cumulative Sum in Load

Thanks guys!

Community Browser