Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate running total/ average while loading data.

Any simple way to calculate the running total/average as a calculated field while loading the data from the tables.

2 Replies
Not applicable
Author

Following discussion is helpful

http://community.qlik.com/message/403453#403453

Anonymous
Not applicable
Author

Zahoor

You can use the peek function in your load script to look at the previous row loaded.

This script code should give you inspiration.

AA :

LOAD * INLINE [

    Value

    1

    2

    3

    4

    5

    6

    7

    8

];

BB:

load

  [Value] ,

  [Value] + if(peek(RunningTotal) > 0 ,  peek(RunningTotal) , 0) as RunningTotal

resident AA

;


drop table AA ;

Best Regards,     Bill