3

私は以下を使用していますが、おそらくAll結果からメンバーを除外するもっと簡単な方法があると思いますか?

WITH 
    SET [Non_All_Distributors] AS
        {FILTER(
            [Distributor Name].members,
            (InStr(1, [Distributor Name].CurrentMember.NAME, "All") = 0) 
            )}
    SET [Non_All_Countries] AS
        {FILTER(
            [Geography Country].members,
            (InStr(1, [Geography Country].CurrentMember.NAME, "All") = 0) 
            )}
SELECT  
    NON EMPTY 
        [Dimension].[Hierarchy].DEFAULTMEMBER 
    ON COLUMNS, 

    NON EMPTY 
        [Non_All_Distributors]
        *
        [Non_All_Countries]
        *
        Tail([Date].[Date - Calendar Month].[Calendar Day].Members,60)  
        *  
        { 
        [Measures].[Revenue], 
        [Measures].[NumClients]
        } 
    ON ROWS 

FROM [OURCUBE]  
4

2 に答える 2

5

使うだけ

SELECT  
    NON EMPTY 
        [Dimension].[Hierarchy].DEFAULTMEMBER 
    ON COLUMNS, 

    NON EMPTY 
        [dimension of Distributor Name].[Distributor Name].[Distributor Name].Members
        *
        [dimension of Geography Country].[Geography Country].[Geography Country].Members
        *
        Tail([Date].[Date - Calendar Month].[Calendar Day].Members,60)  
        *  
        { 
        [Measures].[Revenue], 
        [Measures].[NumClients]
        } 
    ON ROWS 

FROM [OURCUBE]  

ここでセットを定義する必要はありません。行句でディストリビューターと国のメンバーを直接指定できます。

By repeating the attribute name, you restrict the attribute hierarchy - which you refer to by [dim].[attrib name] to the level below the All member, which happens to have the same name as the attribute again. An attribute hierarchy has two levels: level 0 contains the 'All' member and level 1 all the members of the attribute. (This is true only if you did not do special configurations like setting the attribute as non aggregateabable, but I assume the standard case, as you have All members in your hierarchies.

Apart from being more simple, this statement will run much faster, as Filter is a real performance killer in many cases.

于 2013-09-12T17:15:47.090 に答える