Sql Analysis Services Current Date
-
29-09-2019 - |
Question
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?
Solution
CREATE SET CURRENTCUBE.[Current And Future Months]
AS {
StrToMember("[Dim Date].[Calendar].[Month].&[" + Format(now(), "yyyyMM") + "]"):NULL
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow