MDX语句不返回任何内容 [英] MDX Statement Returning Nothing

查看:97
本文介绍了MDX语句不返回任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆