ssas - Getting year-end values from prior year on each result row of MDX query -
i have snapshot fact table time grain of monthly , measure values point in time, not cumulative on time. need derive previous year-end value compare given month's values end of previous year so:
| month | val1 | prevyeval |
| 2014-10 | 101 | 100 |
| 2014-11 | 103 | 100 |
| 2014-12 | 105 | 100 |
| 2015-01 | 110 | 105 |
| 2015-02 | 115 | 105 |
| 2015-03 | 113 | 105 |
...
| 2015-12 | 120 | 105 |
| 2016-01 | 130 | 120 |
etc...
i'm using ssas , time dimension table set such year->quarter->month->day hierarchy.
i can find solutions previous month, rolling number of months , getting ytd cumulative value straight point in time point in time comparison.
i'm trying use lag, ancestor, and/or parallelperiod can't seem above result set.
try:
create member currentcube.[measures].[prevyeval] null; scope([date].[calendar hierarchy].[month].members); [measures].[prevyeval]=([date].[calendar hierarchy].currentmember.parent.parent.prevmember.lastchild.lastchild, [measures].[val1]); end scope;
Comments
Post a Comment