2016-01-12 87 views
0

數下面是我的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。是否有人可以幫助我如何獲取記錄數。

+0

您好請問,任何人可以幫助我獲取記錄數的語法嗎? – Mithra

回答

0

這應該讓你的計數:

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具有非零(非空)的fact sample count

編輯:我爲你創造的是一種衡量標準。您必須聲明一個計算的成員(度量)並在那裏寫入定義,然後使用常規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] 
+0

你好Sourav,對不起,可能是我問一個愚蠢的問題,但我應該把我的意思是在行或列上的查詢我可以請你詳細說明? – Mithra

+0

我試圖做下面SELECT NON EMPTY {[措施]。[事實採樣計數]} ON COLUMNS, 非空 ( {[事實示例]。[樣品參考否]。[樣品參考編號] .ALLMEMBERS}, [Dim Material Master]。[Material Master Master]。[Material Master ID]。[999],[Measures]。[Fact Sample Count] [).CountON)ROWS FROM [LIMSInstCube] WHERE Master ID]。[999]) – Mithra

+0

@Mithra檢查我的編輯。 – SouravA