Say I have sum(Sales)
I want it as a cumulative sum over a time period, to start with Date
So say sum sales for 20191001 is 200, for 20191002 is 300, then it should show 200+300 as the value on 20191002 etc...
Then you can for example use the new for QV12 sortable AGGR function
Aggr(RangeSum(Above(sum(Sales), 0, RowNo())), YearMonth, (Date, (NUMERIC)))
This works for me.
My time period is really not only Date, but it's a cyclic group with Date, YearWeek, YearMonth and Year
The above expression only works for Date, but not for the others
How do I make an expression with cumulative sum that works for this cyclic time group?
Solved! Go to Solution.
Try replacing your direct field in aggr sort argument by expression: GetCurrentField (group_name), like:
Aggr(RangeSum(Above(sum(Sales), 0, RowNo())), YearMonth, (GetCurrentField (group_name), (NUMERIC)))
That is something I wanted to test and post. In fact I typed two possibilities as answer, one with $ and another without, then I thought that, since the getcurrentfield() would actually be evaluated with the chart (since it is dimension-selection sensitive) - the main expression and getcurrentfield() evaluation might work simultaneously. Again, not tested here.
From my understanding of using this in the past, GetCurrentField() will just give the name of the field as a text... to actually make it read as a field, you will need $()... but let me know if you find otherwise while testing.
If the field name doesn't contain space, that should probably not matter. So it's not about evaluating before the actual expression gets evaluated, rather adding '[' ']' to give a field name convention for those even that has spaces in field name.
Edit: I roughly tested and it works (without space in field name obviously)