MDX语句不返回任何内容 [英] MDX Statement Returning Nothing
问题描述
我有一个名为ExDimension
的维度,具有1个名为ExAttribute
的单个属性.我目前在该维度上有2个成员以及unknownmember
及其数据.当我运行以下MDX时,我什么也没回来,我也不明白为什么.谁能给我指引去哪里看看?
I have a Dimension called ExDimension
with 1 single attribute called ExAttribute
. I currently have 2 members in that dimension along with the unknownmember
with data for it. When I run the following MDX, I get nothing back and I don't understand why. Can anyone give me a direction on where to look?
SELECT
{
[ExDimension].[ExAttribute].CHILDREN
}
DIMENSION PROPERTIES [ExDimension].[ExAttribute].[Attribute Code],
[ExDimension].[ExAttribute].[Company],
[ExDimension].[ExAttribute].[Is Current],
[ExDimension].[ExAttribute].[Is Current Store],
[ExDimension].[ExAttribute].[Is Current Chain],
[ExDimension].[ExAttribute].[Attribute Label]
ON 0 FROM [CR Data Warehouse]
推荐答案
您的代码依赖于Analysis Services的隐式类型转换:
Your code relies on an implicit type conversion of Analysis Services:
Children
适用于成员,请参见文档.然后给它一个层次结构.在这种情况下,SSAS将隐式类型转换为层次结构的默认成员. IE.代码
Children
works on a member, see the documentation. And you give it a hierarchy. In this case, SSAS does an implicit type conversion to the default member of the hierarchy. I. e. the code
[ExDimension].[ExAttribute].CHILDREN
等同于
[ExDimension].[ExAttribute].DefaultMember.CHILDREN
在标准情况下,它作为默认成员是All
成员,该成员具有所有普通"成员作为其子代.我假设您的ExAttribute
层次结构具有默认成员,该成员不是All
成员,而是底层的成员.而且没有子项,因此上面的表达式返回空集.
In the standard case, this works as the default member is the All
member, which has all the "normal" members as its children. I would assume that your ExAttribute
hierarchy has a default member which is not the All
member, but a member on the bottom level. And that does not have children, hence the above expression returns the empty set.
假设您的意图是获取ExAttribute
属性层次结构的成员,但All
成员除外,我首选的编码方式是使用
Assuming your intention is to get the members of the ExAttribute
attribute hierarchy except for the All
member, my preferred way of coding this would be to use
[ExDimension].[ExAttribute].[ExAttribute].Members
这不使用隐式类型转换,而是使用ExAttribute
属性层次结构的ExAttribute
级别.属性层次结构通常具有两个级别:仅由All
成员组成的All
级别,以及像属性一样命名的级别,其中包含直接来自维表的所有成员.可能会有变化:如果将属性属性IsAggregatable
设置为false,则All
成员和All
级别将丢失,并且可以将计算所得的成员添加到两个级别.
This does not use an implicit type conversion, and uses the ExAttribute
level of the ExAttribute
attribute hierarchy. Attribute hierarchies normally have two levels: the All
level consisting just of the All
member, and the level named like the attribute, which contains all the members coming directly from the dimension table. There can be variations: If you set the attribute property IsAggregatable
to false, the All
member and the All
level is missing, and you can add calculated members to both levels.
您甚至可以使用
[ExDimension].[ExAttribute].[ExAttribute]
同样,如果有一个级别并需要一个集,则
会有一个隐式类型转换:此隐式类型转换将应用Members
函数.但是我更喜欢露骨,尤其是因为这种方式的代码不能再花那么长的时间了.
as, again, there is an implicit type conversion if you have a level and need a set: This implicit type conversion applies the Members
function. But I prefer to be explicit, especially as the code does not get that much longer this way.
这篇关于MDX语句不返回任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!