Sql Analysis Services Current Date

陌路散爱 提交于 2019-12-20 03:53:14

问题


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:


CREATE SET CURRENTCUBE.[Current And Future Months]
 AS {
StrToMember("[Dim Date].[Calendar].[Month].&[" + Format(now(), "yyyyMM") + "]"):NULL
}


来源:https://stackoverflow.com/questions/3512028/sql-analysis-services-current-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!