Sql-server – SSAS Calculated Field – rolling sum, for a year of days

computed-columndata-warehousemdxsql serverssas

I have a fact table storing employee occurrences incurred day over day.
I need to have a running sum over the past year of an employee's life. I had, on first pass, done this on ETL, making this "Acitve Occurrences" Measure's AggregateFunction set to LastChild.
The problem happens as there can be more then one "entry" in a day. "Entry" is also a measure with its AggregateFunction set to LastChild. The result is that the occurrences still sum in instances with multiple "entry".

All of this feels terribly wrong. It screams to me that the "Active Occurrences" (the 365 day rolling sum) should be a calculation instead of done in the ETL. The problem is my lack of knowledge with MDX, at this point.

What would a calculation for this look like?

The reason why I would need the individual entries in the day, is that they have a reference to a type/reason dimension. Flattening the figures to the single day would lose those individual references.

Thank you in advance.

Best Answer

So the calculated member I came up with is:

sum(
    {ParallelPeriod([Calendar].[Fiscal Calendar].[Date],365,[Calendar].[Fiscal Calendar].CurrentMember):[Calendar].[Fiscal Calendar].CurrentMember},
    [Measures].[Occurrences Received]
)

simple enough, I guess. It could have been the ParallelPeriod for the Year level and 1 though I guess as this is a Fiscal Calendar 365 members at the day level needs to be used.