本文介绍了SQL Analysis Services当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在SSAS中执行仅适用于当前和未来月份的计算(不能使用可用数据进行追溯应用).

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;

我想用当前月份(用该格式)替换201008.

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

有什么想法吗?

推荐答案

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

这篇关于SQL Analysis Services当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 20:31