I want to calculate the aggregate sum of past 2 values + current value + next 2 values with set analysis. With or Without set analysis it works as expect. It works as expected with or without set analysis ("{<Week=>}"
). But when zooming the values of the graph changes accordingly. So I used set analysis. Even though it's not working for my case.
But, when I zoom the chart we are not getting the actual result. Since I used set analysis.
I need the following. Consider this is my data,
|Week | Value |
|------------------|
|01/2011 | 256 |
|02/2011 | 2056 |
|03/2011 | 112 |
|04/2011 | 95 |
|05/2011 | 1069 |
|07/2011 | 125 |
|08/2011 | 73 |
--------------------
I need to plot data for 04/2011
would be (2056+112+95+1069+125)
in the same we need to calculate for each date
I am trying with the following expression:
It works fine: RangeSum(Below(Sum(Value),1,6)) + RangeSum(Above(Sum(Value),1,6)) + Sum(Value)
For zooming I used set analysis as follows,
RangeSum(Below(Sum({<Date=>}Value),1,6)) + RangeSum(Above(Sum({<Date=>}Value),1,6)) + Sum({<Date=>}Value)
This is not working as expected.
This should work as you want:
Backend Code:
Inline:
LOAD * INLINE [
WeekKey,Value
01/2011,256
02/2011,2056
03/2011,112
04/2011,95
05/2011,1069
07/2011,125
08/2011,73
];
dateTemp:
LOAD
WeekKey,
Right(WeekKey,4)&Left(WeekKey,2) as SortOrder,
Left(WeekKey,2) as Week,
Right(WeekKey,4) as Year
Resident Inline;
LOAD
RowNo() as Row,
*
Resident dateTemp
Order By SortOrder ASC;
DROP Table dateTemp;
Your expression:
Sum({<Week=,WeekKey=,Row = {'>=$(=max(Row)-2)<=$(=max(Row)+2) '}>} Value)