这是我的代码......
SELECT
{
[Measures].[ACPPurchaseValue]
} ON COLUMNS
,(
[Date].[YYYYMMDD].[YYYYMMDD]
) ON ROWS
FROM [Kahuna]
WHERE
(
[Reporting Currency].[reportingCurrency].&[1]
,strToSet(@MdxBOSP)
,strToSet(@MdxVIPType)
,strToSet(@MdxHost)
,strToSet(@MdxOperatorName)
);
我怎么说[日期]。[YYYYMMDD]。[YYYYMMDD]< GETDATE()
答案 0 :(得分:0)
您需要首先创建与今天相对应的成员或单个成员集。
以下看起来有点复杂但实际上是一种相当标准的方法 - 由Tomislav Piasevoli提出 - 它与AdvWrks
维度Date
相对:
WITH
MEMBER [Measures].[Key for Today] AS
Format
(
Now()
,'yyyyMMdd'
)
MEMBER [Measures].[Today string] AS
'[Date].[Calendar].[Date].&[' + [Measures].[Key for Today] + ']'
SET [Today] AS
StrToMember
(
[Measures].[Today string]
,constrained
)
...
因此适用于您的情况:
WITH
MEMBER [Measures].[Key for Today] AS
Format
(
Now()
,'yyyyMMdd'
)
MEMBER [Measures].[Today string] AS
'[Date].[YYYYMMDD].[YYYYMMDD].&[' + [Measures].[Key for Today] + ']'
SET [Today] AS
StrToMember
(
[Measures].[Today string]
,constrained
)
SELECT
[Measures].[ACPPurchaseValue] ON 0
,{null:[Today].item(0).item(0)} ON 1
FROM [Kahuna]
WHERE
(
[Reporting Currency].[reportingCurrency].&[1]
,strToSet(@MdxBOSP)
,strToSet(@MdxVIPType)
,strToSet(@MdxHost)
,strToSet(@MdxOperatorName)
);
另外两种可以简化每个人生活的更好的解决方案:
不要在您的多维数据集中实现未来日期
保留未来日期,但添加一个名为[Today]
的自定义集和一个名为today的计算成员作为日期的所有成员。