Accumulate Measure up to Prior Period
Posted: Tue Jun 05, 2012 8:05 pm
Hello,
Would ilke to set up a rule that summarizes data for all previous periods. For example, when the current period is Jan-2010, then the meausue 'Accume Value' should summarize the Value for all months before Jan-2011 and not include future periods, Feb 2011 below.
Value Accume value
Oct 2010 10 0
Nov-2010 20 10
Dec-2010 30 30
Jan-2011 40 60
Feb-2011 50 0
To do this, I set up an a numeric attribute on the Month dimension named ElementIndex. The thought is I can get the index of the current Month element and only summarize the values where the data has a Month element that is less than the CurrentMonthIndex.
I am aware of the DIMIX and DIMNM functions; but I wany to stay away from them incase the elememtns are reindexed in the future.
['CurrentMonthIndex'] = ATTRN('Month', !Month, 'ElementIndex');
['ITD Variance to Snapshot'] =
IF(CurrentMonthIndex'] < ATTRN('Month', !Month, 'ElementIndex'),
DB('MonthlyAnalysis', 'All Years', !Entity, !MSO, !Titles, !Format, !MonthlyBalType,'Rentrak Variance to Snapshot'), 0);
This will not work, since the ATTRN function returns the same index value.
Appreciate you help.
Thanks
Walt
Would ilke to set up a rule that summarizes data for all previous periods. For example, when the current period is Jan-2010, then the meausue 'Accume Value' should summarize the Value for all months before Jan-2011 and not include future periods, Feb 2011 below.
Value Accume value
Oct 2010 10 0
Nov-2010 20 10
Dec-2010 30 30
Jan-2011 40 60
Feb-2011 50 0
To do this, I set up an a numeric attribute on the Month dimension named ElementIndex. The thought is I can get the index of the current Month element and only summarize the values where the data has a Month element that is less than the CurrentMonthIndex.
I am aware of the DIMIX and DIMNM functions; but I wany to stay away from them incase the elememtns are reindexed in the future.
['CurrentMonthIndex'] = ATTRN('Month', !Month, 'ElementIndex');
['ITD Variance to Snapshot'] =
IF(CurrentMonthIndex'] < ATTRN('Month', !Month, 'ElementIndex'),
DB('MonthlyAnalysis', 'All Years', !Entity, !MSO, !Titles, !Format, !MonthlyBalType,'Rentrak Variance to Snapshot'), 0);
This will not work, since the ATTRN function returns the same index value.
Appreciate you help.
Thanks
Walt