Hi AllI have received a requirement to build a rolling total. I have found many articles articulating how you can sum for a period using periodstodate and so forth.My requirements however is to do the rolling total only on selected period members.Below is an example of the periods and what is required[img]http://www.sqlservercentral.com/Forums/Attachment19819.aspx[/img]Now for the measure. When hardcoding the "first" member the calculation works as advertised.[code="plain"]CREATE MEMBER CURRENTCUBE.[Measures].[Rolling Total] AS SUM( ([Date].[Calendar].&[2015].&[12]:[Date].[Calendar].Currentmember) , [Measures].[Sales Amount]), VISIBLE = 1 ; [/code]This however needs to change so that the "first" period member / Current member is automatically calculated.Was thinking in the lines of:[code="plain"]CREATE MEMBER CURRENTCUBE.[Measures].[Rolling Total 2] AS SUM( (( strtomember(HEAD( [Date].[Calendar].Currentmember.member_unique_name ,1)) ):[Date].[Calendar].Currentmember), [Measures].[Sales Amount]), VISIBLE = 1 ;[/code]Please any suggestions are most welcome.ThanksJacques
↧