此MDX函数引发错误:
with member measures.x as
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].[Date].currentmember.value
,
[Measures].[current balance]
)
select measures.x on columns,
[Branch].[HeadOffice Branch].[Head Office Code] on rows
from MyCube
错误是: CURRENTMEMBER函数需要1参数的层次结构表达式。使用了成员表达式。
但是当我使用时 [日期]。[日期]。[日期]。& [20160101]:[日期]。[日期]。[日期]。& [20160131] 它运作良好
为什么?
答案 0 :(得分:2)
这是有效的mdx:
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
虽然不是:
WITH member measures.x AS
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
,
[Measures].[current balance]
)
它无效,因为圆括号(...)
表示元组,但元组需要精确的坐标,因此第一个参数不能是一个集合。
您可以添加一个聚合,例如SUM:
WITH member measures.x AS
SUM
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
,
[Measures].[current balance]
)
这是有效的mdx
但如果您在上下文中没有[Date].[Date]
,即在WHERE
或SELECT
子句中,那么它返回的全部是{{1}会员。
您为什么使用All
?
答案 1 :(得分:1)
CURRENTMEMBER适用于属性层次结构(在您的情况下为[Date]。[Date])。所以[日期]。[日期] .CURRENTMEMBER将有效。
此外,您需要取出值选择器,因为表达式返回一组日期(成员:成员返回这两个成员之间的所有成员的集合)。