自己解决了。下面的代码完成了这项工作:
WITH
MEMBER [Measures].[Days in the period passed] AS
FILTER
(
Descendants([Time].[Calendar], [Time].[Calendar].[Day]),
[Time].[Day].Properties("Day key") <= FORMAT(NOW(), "yyyyMMdd")
).COUNT
编辑:更优雅和正确的方式是范围:
SCOPE
(
[Measures].[Days in the period passed], [Time].[Day].[Day].Members
);
THIS = IIF([Time].[Day].CurrentMember.Properties( "Key0" ) <= FORMAT(NOW(), "yyyyMMdd"),
[Measures].[Days in the period],
NULL);
END SCOPE;
检查选择:
SELECT
([Time].[Calendar].[Mouth]) ON COLUMNS,
(([Measures].[Days in the period passed])) ON ROWS
FROM [TestCube]