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

accumutative sum in script

Hi qlikview communtity,

I am trying to make a accumulative sum in the script but nothing seems to work. I have the belowtable:

DateEmplRefMinutesWorkedFlexGained
59
14/10/2013FL238464-16
15/10/2013FL2384811
16/10/2013FL23851333
17/10/2013FL2384811
21/10/2013FL238465-15
22/10/2013FL23853555

I have managed to do it on a straight table but I need it inside the script.

Already tried:

RangeSum(FlexGained,peek(AccumFlexGained)) as AccumFlexGained


but i got some lagre negative numbers back isted of an accurate result

Any ideas???


Tags (1)
6 Replies
Not applicable

Re: accumutative sum in script

Im sorry for my english but this works Niko :

Primero:

LOAD * Inline [

Date,EmplRef,MinutesWorked,FlexGained

14/10/2013, FL238 ,464, -16

15/10/2013 ,FL238 ,481 ,1

16/10/2013 ,FL238 ,513 ,33

17/10/2013 ,FL238 ,481 ,1

21/10/2013 ,FL238 ,465 ,-15

22/10/2013 ,FL238, 535 ,55

];

Segunda:

load

Date,

EmplRef,

MinutesWorked,

FlexGained,

RangeSum(FlexGained,peek(AccumFlexGained)) as AccumFlexGained

Resident Primero;

DROP TABLE Primero;

Regards!

Not applicable

Re: accumutative sum in script

Hi Raul and thanks for the quick responce,

I can see that it works on your version but the behaviour on my impementation is not the same.

I use the exact same formula to calculate the running average but insted I get numbers like -6607388,-6607185

and so forth.

I can not figure out why is that....

Can anyone help?? Has anyone had any similar issue??

Not applicable

Re: accumutative sum in script

Any ideas??? I have been trying everything but with no luck..

MVP
MVP

Re: accumutative sum in script

Could you share your sample app?

Not applicable

Re: accumutative sum in script

Here is a sample,

I it took me a minute to hide some sensitive information.

As you can see in the employee number = FL238 i what i am accually trying to achieve is to reset the flex to 480 if its more than that every friday and to keep accumulating from that flex afterwards. I would appreciate your help

MVP
MVP

Re: accumutative sum in script

Hi,

A quick fix before going into details; try putting single quotes around field name in peek() like:

RangeSum(FlexGained,peek('AccumFlexGained')) as AccumFlexGained

Community Browser