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

Summing Previous Months

Hi Community,

I have a field that has a value in period 0 that is the begining amount of 100.  Some of the following periods either add or subract from this and have values like -4, or 7.  How do I get the value desired below given the table below:

YearPeriodValues in FieldValue Desired
20110100100
201110100
201123103
201130103
201140103
20115-499
201167106
201170106
201180106
201195111
2011100111
2011112113
201112-1112
201210112
201220112
201230112
2 Replies
Not applicable
Author

i.e. Can I do this with set analysis or in the script loading?

swuehl
MVP
MVP

Well, if you can do it in the script, do it in the script, maybe using something like:

TEST:

LOAD *, rangesum([Values in Field],peek([ValueDesired])) as ValueDesired;

LOAD Year,

     Period,

     [Values in Field],

     [Value Desired]

FROM

[http://community.qlik.com/thread/52426?tstart=0]

(html, codepage is 1252, embedded labels, table is @1);

Or create a straight table chart with dimensions Year and Period and as expression:

=rangesum(above(total [Values in Field],0,RowNo(total )))