简体   繁体   English

SSAS MDX 脚本 - 范围为除 [All] 成员之外的层次结构的所有成员

[英]SSAS MDX Script - Scope to all members of a hierarchy except the [All] member

Is there anyway to write a scope statement that would scope on all members of a date hierarchy except the [All] member?无论如何要编写一个范围声明,该范围声明将作用于除 [All] 成员之外的日期层次结构的所有成员?

I have tried many many ways using FILTER, EXCEPT, DESCENDANTS, ect but every time, I get the error message saying: An arbitrary shape of the sets is not allowed in the current context.我尝试了很多使用 FILTER、EXCEPT、DESCENDANTS 等的方法,但每次,我都会收到错误消息:当前上下文中不允许使用任意形状的集合。

I need to do some calculations at levels lower than the ALL member and then, let it rollup contextually (according to the excel pivot table selection)我需要在低于 ALL 成员的级别进行一些计算,然后根据上下文进行汇总(根据 excel 数据透视表选择)

Any ideas?有任何想法吗?

This has been on my plate for almost a week now and I've found no way around it other than writing multiple scope statements for each level of the hierarchy but in the end I will have to repeat this many times as we are doing this for many date dimensions这已经在我的盘子里将近一个星期了,除了为层次结构的每个级别编写多个范围语句之外,我没有找到其他方法,但最后我将不得不重复多次,因为我们正在这样做许多日期维度

There has to be a simpler way, right?必须有一个更简单的方法,对吧?

Scope([Date].[Date].Members, [Date].[Year].[Year].Members)

Date.Date is the key attribute in the Date dimension. Date.Date是 Date 维度中的关键属性。 [Date].[Date].Members means all the dimension including the lowest level and above. [Date].[Date].Members表示包括最低级别及以上级别的所有维度。 [Date].[Year].[Year].Members means and up to the year level but not the grand total. [Date].[Year].[Year].Members是指直到年份级别,但不是总计。

The best way I have found is to use the Descendants function with the AFTER description flag:我发现的最好方法是使用带有AFTER描述标志的Descendants函数:

SCOPE([Date].[Date].[All], , AFTER);
// Calculations here.
END SCOPE;

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

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