MDX:排除具有度量的相同维属性的成员 [英] MDX: Exclude a member that share same dimension property of a measure
问题描述
方案:我有一个measure(Sum),并且在所有情况下我都需要此总和的结果,但不包括事实表中注册的有关用户/天筛选器的最后一个元素.这些元素在其他维度上具有相同的属性.
Scenario: I have a measure( Sum ), and I need in all situations the result of this sum excluding the last element registered in the fact table respecting the user/day filter. These elements share the same attributes in the other dimensions.
示例:2019年10月29日事实表中UserA的度量:
Example: Measure of UserA in fact table in 2019/10/29:
RegisterA: 5
RegisterB: 11
RegisterC: 13
RegisterD: 7
(系统用户看到的结果中将不包含RegisterD.最终结果:29)
( RegisterD will be not included in the result that the system user will see. Final result: 29 )
示例:在2019/10/26至2019/10/29之间的事实表中UserB的度量:
Example: Measure of UserB in fact table between 2019/10/26 to 2019/10/29:
RegisterA: 2
RegisterB: 45
RegisterC: 21
RegisterD: 19
(系统用户看到的结果中将不包含RegisterD.最终结果:68)
( RegisterD will be not included in the result that the system user will see. Final result: 68 )
这些元素共享相同的维度属性,没有任何区别,但是维度过滤器中的最后一个事实寄存器(Day和User)将永远不包含在总和中.
These elements share the same dimension property, without any difference, but the last fact register inside dimension filters( Day and User ) will never be included in the sum.
我该怎么办?
谢谢
推荐答案
在项目中,您需要两次定义每个度量,一次使用"sum",一次使用"last value".现在定义一个计算所得的成员,该成员减去总和中的最后一个值.在查询中使用此计算所得的成员.
In your project you need to define each of your measures twice once with "sum" usage and once with "last value" usage. Now define a calculated member that substracts the last value from the sum. Use this calculated member in your queries.
这篇关于MDX:排除具有度量的相同维属性的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!