在 MDX 中为一组成员创建度量
Create a measure in MDX for a set of Members
我需要如下内容:
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])
我在第一种情况下得到的错误是:
The function expects a string or numeric expression for the
argument. A tuple set expression was used.
反对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];
我需要如下内容:
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])
我在第一种情况下得到的错误是:
The function expects a string or numeric expression for the argument. A tuple set expression was used.
反对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];