简体   繁体   English

根成员的后代(MDX)

[英]Descendants (MDX) of root member

Environment: SSAS v12. 环境:SSAS v12。

Why the following function 为什么下面的功能

DESCENDANTS([Dim1].[Hier1].[(All)])

returns only [Dim1].[Hier1].[(All)] ? 仅返回[Dim1].[Hier1].[(All)]吗?

Expectation is to return the root member and all it's descendants. 期望返回根成员及其所有后代。

Or how to achieve that? 或如何实现?

PS Specifying [ , Level_Expression [ ,Desc_Flag ] ] does not help... PS指定[ , Level_Expression [ ,Desc_Flag ] ]没有帮助...

Many thanks in advance. 提前谢谢了。

您可以指定要走多远,无论是到达特定级别还是到达树叶:

DESCENDANTS([Dim1].[Hier1].CurrentMember, [Dim1].[Hier1].[Hier1], LEAVES)

You can try adding one of the flags: 您可以尝试添加以下标志之一:

DESCENDANTS(
    [Dim1].[Hier1].[All]   //<<member
  , [Dim1].[Hier1].[(All)] //<<level
  , SELF_BEFORE_AFTER      //<<flag
)

Documentation of the function is here: https://docs.microsoft.com/en-us/sql/mdx/descendants-mdx 该功能的文档在这里: https : //docs.microsoft.com/zh-cn/sql/mdx/descendants-mdx

The documentation gives a way of experimenting with the different flags: 该文档提供了一种尝试不同标志的方法:

SELECT Descendants  
   ([Geography].[Geography].[Country].&[United States]  
      //, [Geography].[Geography].[Country]  
   , [Geography].[Geography].[City]  
      //, [Geography].[Geography].Levels (3)  
      //, SELF   
      //, AFTER  
      , BEFORE  
      // BEFORE_AND_AFTER  
      //, SELF_AND_AFTER  
      //, SELF_AND_BEFORE  
      //,SELF_BEFORE_AFTER  
      //,LEAVES   
   ) ON 0  
FROM [Adventure Works] 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM