Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

summing over the period in a script

I've uploaded a table with several dimensions as shown below

Capture.PNG

I need to sum up "saldi" starting from the first period in a cumulative way, that's

1st period sum = saldi 1st period

2nd period sum = saldi 1st period + saldi 2nd period

3rd period sum = saldi 1st period + saldi 2nd period + saldi 3rd period...

... and so on

I'm in trouble because I'm not able to do it.

Thanks in advance

Claudio

1 Reply
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Your best bet may be to upload another dimension which deals which allows a single source value to appear in many periods.


The table would be something like:

Accumulate:

LOAD

  Saldi,

  Cumulative

INLINE [

Saldi,Cumulative

01,01

02,01

02,02

03,01

03,02

03,03

04,01

etc...

];

This way any value that exists in Saldi 03 is associated with cumulative periods 01, 02 and 03.

You may run into some issues with QlikView treating some of the values as strings and others as text - causing the associations not to work but you can probably work around this.  You also have the issue that you could potentially have many years - do you know how you will want to accumulate this?

The accumulation table could be built in a nested loop, or driven from a spreadsheet with the join values.

Hope that gives you some pointers.

Steve