2014-10-31 59 views
0

我執行這個查詢,並給了我這個錯誤:MDX:如何獲得維數

Infinite Recursion Detected: The loop of dependencies is: Direct Reporting->Direct Reporting.

任何人可以幫助我嗎?

WITH 
    MEMBER [Measures].[Direct Reporting] AS COUNT([Employee].[Employees].Members, EXCLUDEEMPTY) 
SELECT 
    {[Measures].[Direct Reporting]} ON COLUMNS, 
    {[Geography].[Country].AllMembers} ON ROWS 
FROM [Adventure Works] 

回答

0

您已經選擇了特殊類型的層次結構:父/子層次結構。

這裏是針對advWks立方體的計數的示例:

WITH 
    MEMBER [Measures].[aCount] AS 
    Sum 
    (
     (
     [Customer].[Customer].[Customer] 
     ,[Customer].[Customer Geography].CurrentMember 
    ) 
    ,IIF 
     (
     [Measures].[Internet Order Quantity] > 50 
     ,1 
     ,0 
    ) 
    ) 
SELECT 
    { 
    [Measures].[Direct Reporting] 
    ,[Measures].[Internet Order Count] 
    } ON COLUMNS 
,{[Customer].[Customer Geography].[Country].MEMBERS} ON ROWS 
FROM [Adventure Works]; 
0

指定Count與EXCLUDEEMPTY意味着引擎需要評估由尺寸的每個成員和當前[處理方法]中引用的多維數據集的細胞。對於SSAS行爲不是100%肯定的,但似乎目前的[Measures]是calc。度量被定義爲自身:因此是無限循環。

要解決它,你可以明確定義[措施]:

WITH MEMBER [Measures].[Direct Reporting] AS COUNT({ [Measures].[use-here-your-measure] } * [Employee].[Employees].Members, EXCLUDEEMPTY)

也許使用NonEmpty功能:

AS Count(NonEmpty([Employee].[Employees].Members, [Measures].[use-here-your-measure]))

希望有所幫助。