我需要以下内容:
with member Measures.Test2 as (Measures.Test, {[Assets Monthly].[Disbursed Date].&[2014], [Assets Monthly].[Disbursed Date].&[2015]})
select Measures.Test2 on columns
from databaseX
仅当我只用一个成员设置它时才有效,例如:
with member Measures.Test2 as (Measures.Test, [Assets Monthly].[Disbursed Date].&[2014])
我在第一种情况下得到的错误是:
该函数需要一个字符串或数字表达式 论点。使用了元组集表达式。
答案 0 :(得分:1)
反对AdvWrks
:
WITH
MEMBER Measures.Test2 AS
Sum
(
{
[Date].[Calendar].[Calendar Year].&[2006]
,[Date].[Calendar].[Calendar Year].&[2007]
}
,[Measures].[Internet Sales Amount]
)
SELECT
Measures.Test2 ON COLUMNS
FROM [Adventure Works];
你的剧本:
WITH
MEMBER Measures.Test2 AS
Sum
(
{
[Assets Monthly].[Disbursed Date].&[2014]
,[Assets Monthly].[Disbursed Date].&[2015]
}
,Measures.Test
)
SELECT
Measures.Test2 ON COLUMNS
FROM databaseX;
这更漂亮。在Date层次结构上创建一个计算成员,并在WHERE
切片器中删除度量:
WITH
MEMBER [Date].[Calendar].[testPeriod] AS
Aggregate
(
{
[Date].[Calendar].[Calendar Year].&[2006]
,[Date].[Calendar].[Calendar Year].&[2007]
}
)
SELECT
[Date].[Calendar].[testPeriod] ON COLUMNS
FROM [Adventure Works]
WHERE
[Measures].[Internet Sales Amount];