Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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???


6 Replies
Not applicable
Author

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
Author

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
Author

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

tresesco
MVP
MVP

Could you share your sample app?

Not applicable
Author

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

tresesco
MVP
MVP

Hi,

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

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