Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

accumulation in script

I am trying to get a new field that is an accumulation of another field.

i can do this on front end - using RangeSum(Above(LoginLogoff,0,RowNo()))   .  This works just fine.

i am trying to do this during the intial load using -  if ((Previous(iKeyPart1)=iKeyPart1),Peek('ActiveLogins'),0)+LoginLogoff as ActiveLogins

It is giving me strange results. it seems to be working until the accumulation reaches 3. Then i start seeing values that dont quite make sense.

QV - Accumulation.png

Need help!

Labels (1)
10 Replies
swuehl
Champion III
Champion III

Try using peek() instead of previous().

Then I think you may need to sort also by EventDateTime?

If you are only interested in the sum(LoginLogoff), you can also use a group by load like

DingoLog2:

LOAD

          DingoUserName, StreamId, DistalHostIp, sum(LoginLogoff) as LoginsOnThisHost2

    Resident DingoLog group by DingoUserName, StreamId, DistalHostIp;

DROP Table DingoLog;