MDX查询返回记录数 [英] MDX Query to return the number of records

查看:105
本文介绍了MDX查询返回记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的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.请问有人可以帮助我如何获取记录数.

So it gives 10 records as my out put. I have a requirement where I have to show the number of records that are returned from the query i.e 10. Can any one please help me how to get the records count.

推荐答案

这应该使您计数:

NonEmpty
(
{[Fact Sample].[Sample Reference No].[Sample Reference No].ALLMEMBERS},
([Dim Material Master].[Material Master ID].&[999], [Measures].[Fact Sample Count])
).Count

这个想法是从material master ID 999的[Fact Sample].[Sample Reference No].[Sample Reference No]级别获取一组非空成员,这些成员具有非零(非空)fact sample count.

The idea is to get the set of non-empty members from the [Fact Sample].[Sample Reference No].[Sample Reference No] level for the material master ID 999 which have a non-zero(non-null) fact sample count.

编辑:我为您创建的是一种度量.您必须声明一个计算所得的成员(度量),然后在其中写入定义,然后使用常规的SELECT {...} FROM {...} WHERE {...}构造对其进行访问.

EDIT : What I created for you is a measure. You have to declare a calculated member(measure) and write the definition there and then access it using the regular SELECT {...} FROM {...} WHERE {...} construct.

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查询返回记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆