views:

38

answers:

1

I need to perform a calculation in SSAS which only applies to the current and future months (it can't be applied retrospectively using the available data).

I can do this by using the calendar hierarchy and hard coding today's month as follows...

SCOPE([Measures].[RollingStock]);        
    ([Dim Date].[Calendar].[Month].&[201008]:NULL) = 
    ([Measures].[Quantity On Hand] 
     - [Measures].[SO Open Quantity] 
     + [Measures].[PO Open Quantity] 
     - [Measures].[Forecasts Quantity]);        
END SCOPE; 

I want to replace 201008 with the current month (in that format).

Any ideas?

+1  A: 
CREATE SET CURRENTCUBE.[Current And Future Months]
 AS {
StrToMember("[Dim Date].[Calendar].[Month].&[" + Format(now(), "yyyyMM") + "]"):NULL
}
Meff
Yeah, that should do it. Use VBA to create a string which will match the member name, and then convert the string into a set.
Magnus Smith