[英]In MDX, how is the hierarchy chosen when referencing the All member?
I have a cube with a dimension containing a parent-child hierarchy and several non visible attributes. 我有一个多维数据集,其维度包含父子层次结构和几个不可见的属性。 The only way this dimension is supposed to be queried is via the parent-child hierarchy. 应该查询此维度的唯一方法是通过父子层次结构。
My problem is how the following MDX name is resolved : 我的问题是如何解决以下MDX名称:
[MyDimension].[All].Children
In that case, one of the non visible attribute is chosen (resolved to : [MyDimension].[MyInvisibleAttributeUsedOnlyForOrdering].[All].Children
) which leads to unexpected results. 在这种情况下,选择一个非可见属性(解析为: [MyDimension].[MyInvisibleAttributeUsedOnlyForOrdering].[All].Children
),这会导致意外结果。
The problem appears when using a CUBEMEMBER/CUBEVALUE
function in Excel. 在Excel中使用CUBEMEMBER/CUBEVALUE
函数时出现问题。 As Excel does not take into account the invisible attributes, the autocomplete jumps directly from [MyDimension]
to [MyDimension].[All]
without asking the user to specify a hierarchy. 由于Excel没有考虑不可见属性,因此自动完成功能直接从[MyDimension]
跳转到[MyDimension].[All]
而不要求用户指定层次结构。 When another attribute is visible, it works fine because Excel's autocomplete force the user to choose one of the hierarchies, leading to an inambiguous [MyDimension].[MyParentChildHierarchy].[All].[MyCorrectMembers]
. 当另一个属性可见时,它工作正常,因为Excel的自动完成强制用户选择其中一个层次结构,导致一个不明确的[MyDimension].[MyParentChildHierarchy].[All].[MyCorrectMembers]
。
One possible workaround is to set all invisible attribute as non-aggregatable, that way [MyDimension].[All]
make only sense in the scope of my parent-child hierarchy but i'm looking to a better and more versatile solution. 一种可能的解决方法是将所有不可见属性设置为不可聚合,这样[MyDimension].[All]
仅在我的父子层次结构的范围内有意义,但我正在寻找更好,更通用的解决方案。
Thanks in advance for any solution or explanation of SSAS behavior. 提前感谢您对SSAS行为的任何解决方案或解释。
When SSAS guesses an attribute hierarchy for dimension, my observation is that it takes the first one as defined in the dimension.xml file. 当SSAS猜测维度的属性层次结构时,我的观察是它采用了dimension.xml文件中定义的第一个。
In order to see/change what attribute is first (ie the first child Attribute of the Attributes element), you need to import your SSAS database into a Visual Studio project, right-click the dimension choose View Code, then scroll down to the Attributes element. 要查看/更改首先属性(即Attributes元素的第一个子属性),需要将SSAS数据库导入Visual Studio项目,右键单击维选择View Code,然后向下滚动到Attributes元件。 You can copy/paste the parent-child Attribute and move it to the top and all things begin equal your MDX should resolve against that attribute hierarchy instead of (presumably) the key attribute. 您可以复制/粘贴父子属性并将其移动到顶部,并且所有事情都等于您的MDX应该针对该属性层次结构而不是(可能)关键属性进行解析。
I assume Hierarchy elements behave the same way in the Hierarchies collection, but haven't actually tried that. 我假设层次结构元素在Hierarchies集合中的行为方式相同,但实际上没有尝试过。
Don't know if it will work in the Excel case, but in the general MDX case it is the technique I've been using for years to get my PC attribute to be the default one. 不知道它是否适用于Excel的情况,但在一般的MDX情况下,这是我多年来一直使用的技术,使我的PC属性成为默认属性。
Does the function StripCalculatedMembers
help in your situation? 在您的情况下, StripCalculatedMembers
功能是否有帮助?
I think it might remove more than you want removed. 我认为它可能会删除超出您想删除的内容。
MSDN reference is here: https://msdn.microsoft.com/en-us/library/ms145983.aspx MSDN参考文献在这里: https : //msdn.microsoft.com/en-us/library/ms145983.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.