Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
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!

10 Replies
swuehl
MVP
MVP

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;