Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Tags (1)
1 Reply
MVP
MVP

Re: summing over the period in a script

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

Community Browser