Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have an Value and time in a small table.
Load
Value,
time
from table;
Jan 10
Feb 15
Mar 20
Now I want to accumulate the values for each month, e.g.
Jan 10
Feb 25
Mar 45
I want to do it in script while loading the table, it is possible? Maybe it is too simple and I am thinking in wrong directions.
Thanks in advance
Thomas
RangeSum(Value, Peek('Cumulative')), Value) AS Cumulative
This is what you need while loading.
Hope this helps
Regards
Sravan
hi,
Sravan's answer works - and is very neat.
i think there is a typo tho' and it should read
RangeSum(Value, Peek('Cumulative')) AS Cumulative
I tested with a preceeding load (see below)
loadData:
load *
, RangeSum(Value, Peek('Cumulative')) AS Cumulative
;Load * inline
[
time,Value
Jan , 10
Feb , 15
Mar , 20
];
I didn't think it was possible to reference a field which is not present in the data source. But there you go - not the first time I've learnt something new here!
Thank you very much, Sravan, it works
Hi:
It is always better to do calculations in the script since you obtain those as a field.
In the case of cumulative fields there is an inconvenience.
If you want to apply a filter like Kind, Class, Type, Account, Client, etc, then your cumulative field just won’t work.
In that case, you’ll have to cumulate in the table, using inter record functions.
Ok.