0

我的子父层次结构有一个奇怪的问题,当所有子一元运算符都是 + 时,父级的计算不正确。

这是带有一元运算符的父子结构的运行情况。

-PBIT (+)
   -OtherIncome    (+)
   -GrossProfit    (+)
      -Sales       (+)
      -Cost Of Sales   (-)

这是我遵循的指南http://geekswithblogs.net/darrengosbell/articles/57811.aspx并且一切都很好,除了任何有孩子都使用加号运算符的父母都会添加太多。

这是带有数据的输出。

在此处输入图像描述

如您所见,PBIT 值是将销售额、销售成本和其他收入相加得到的值。(即使销售成本一元运算符为负!!)

起初我认为它可能只是 excel,但查看它和 MDX 查询给出了相同的值。

为什么?似乎只有当一元运算符为 + 时,其他任何运算符都可以正常工作。

4

2 回答 2

1

The post that you refer to does not describe setup of parent child hierarchies with unary operators, as I would have assumed from the context, but describes how one can use one member in several positions in a parent-child hierarchy. And this involves a many-to-mny relationship. According to http://connect.microsoft.com/SQLServer/feedback/details/243429/wrong-calculation-for-unary-operator-with-many-to-many-relationships, it is a known limitation of Analysis Services that unary operator aggregation does not work properly with many-to-many-relationships, and it does not seem like Microsoft is going to change that anytime soon.

But at least it seems you have found a workaround.

于 2013-08-22T18:49:26.040 回答
0

我建议阅读http://www.sqlbi.com/articles/many2many/的多对多革命白皮书中的“使用一元运算符的层次结构重分类”一章, 它为该问题提供了一个很好的解决方案。

或者,通过使用自定义汇总成员,您可以实现类似的目标。

于 2013-08-26T10:00:30.370 回答