MDX查询到return条记录
MDX Query to return the number of records
下面是我的 MDX 查询
SELECT NON EMPTY
{ [Measures].[Fact Sample Count] } ON COLUMNS,
NON EMPTY
{ (
[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS
) } ON ROWS
FROM [LIMSInstCube]
WHERE ( [Dim Material Master].[Material Master ID].&[999] )
所以它给出了 10 条记录作为我的输出。我有一个要求,我必须显示从查询返回的记录数,即 10。任何人都可以帮助我如何获得记录数。
这应该让你计数:
NonEmpty
(
{[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS},
([Dim Material Master].[Material Master ID].&[999], [Measures].[Fact Sample Count])
).Count
想法是从 [Fact Sample].[Sample Reference No].[Sample Reference No]
级别获取 material master ID
999 的 non-empty 成员集合,其中 non-zero(non-null) fact sample count
.
EDIT :我为您创建的是一个度量。您必须声明一个计算成员(度量)并在那里编写定义,然后使用常规 SELECT {...} FROM {...} WHERE {...}
构造访问它。
WITH MEMBER Measures.YourCustomizedCountMeasure AS
NonEmpty (
[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS,
([Dim Material Master].[Material Master ID].&[999], [Measures].[Fact Sample Count])
).Count
SELECT Measures.YourCustomizedCountMeasure ON 0
FROM [LIMSInstCube]
下面是我的 MDX 查询
SELECT NON EMPTY
{ [Measures].[Fact Sample Count] } ON COLUMNS,
NON EMPTY
{ (
[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS
) } ON ROWS
FROM [LIMSInstCube]
WHERE ( [Dim Material Master].[Material Master ID].&[999] )
所以它给出了 10 条记录作为我的输出。我有一个要求,我必须显示从查询返回的记录数,即 10。任何人都可以帮助我如何获得记录数。
这应该让你计数:
NonEmpty
(
{[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS},
([Dim Material Master].[Material Master ID].&[999], [Measures].[Fact Sample Count])
).Count
想法是从 [Fact Sample].[Sample Reference No].[Sample Reference No]
级别获取 material master ID
999 的 non-empty 成员集合,其中 non-zero(non-null) fact sample count
.
EDIT :我为您创建的是一个度量。您必须声明一个计算成员(度量)并在那里编写定义,然后使用常规 SELECT {...} FROM {...} WHERE {...}
构造访问它。
WITH MEMBER Measures.YourCustomizedCountMeasure AS
NonEmpty (
[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS,
([Dim Material Master].[Material Master ID].&[999], [Measures].[Fact Sample Count])
).Count
SELECT Measures.YourCustomizedCountMeasure ON 0
FROM [LIMSInstCube]