如何通过MDX查询应用Hierarchize和Order by

时间:2016-05-05 10:22:27

标签: mdx olap xmla

我需要按降序排序Dimension。不使用HIERARCHIZE关键词一切正常。这里我需要HIERARCHIZE才能订购层次结构级数据。

Select NON EMPTY({[Measures].[Internet Sales Amount]}) dimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS ,NON EMPTY(HIERARCHIZE({{ORDER(drilldownlevel([Customer].[Customer Geography]),[Customer].[Customer Geography].CurrentMember.MEMBER_CAPTION,desc)}})) dimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS

enter image description here enter image description here

2 个答案:

答案 0 :(得分:0)

不幸的是,我没有AdvWrks多维数据集来测试以下内容:

from .mod1 import fun1

看起来我在这里遇到过类似问题的测试解决方案:
Issue with Order function and Crossoins in MDX

看起来上面的应用程序是这样的:

SELECT 
  NON EMPTY
     [Measures].[Internet Sales Amount] ON 0
 ,NON EMPTY
      ORDER(
         {
           HIERARCHIZE([Customer].[Customer Geography].[COUNTRY].MEMBERS)
          ,[Customer].[Customer Geography].[COUNTRY].&[GERMANY].CHILDREN
         }
        ,[Customer].[Customer Geography].CurrentMember.MEMBER_CAPTION
        ,BDESC
      )
    )  ON 1
FROM [Adventure Works];

答案 1 :(得分:0)

解决了以下查询的问题

SELECT 
NON EMPTY [Measures].[Internet Sales Amount] ON 0,
NON EMPTY
    Order(
        Hierarchize(
           [Customer].[Customer Geography].[Country].&[Germany].Children
        )
      ,[Customer].[Customer Geography].CurrentMember.MEMBER_CAPTION
      ,DESC
    )
ON 1
FROM [Adventure works];