汇总前如何将两个量度相乘 [英] How to multiply two measures prior to aggregation
本文介绍了汇总前如何将两个量度相乘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两种措施.第一个是数量,第二个是值-1,0和1,因此表如下所示:
I have two measures. The first is amount, and the second consist of values -1,0 and 1, so table looks like this:
Amount Sign
--------------
400 -1
200 1
300 0
我想要得到的结果是400*(-1) + 200*1 + 300*0 = -200
,但是我正在得到(400+200+300)*(-1+1+0) = 0
Result I want to get is 400*(-1) + 200*1 + 300*0 = -200
, but I am getting (400+200+300)*(-1+1+0) = 0
这是我的计算成员:
WITH
MEMBER [Measures].[Result]
AS
[Measures].[Sign]*[Measures].[Amount]
select
[Measures].[Result] on 0,
[Time].[Time].members on 1
from [MyCube]
推荐答案
在您的SSAS项目中,转到数据源视图,为基础事实表添加NamedCalculation.在那做您解释的乘法.现在,在多维数据集中将其作为度量.它的行为将完全像您希望的那样.
In you SSAS project, go to the datasource view, for the underlying fact table add a NamedCalculation. In that do the multiplication that you explained. Now in the Cube add that as a measure. It will behave exactly like you want it to behave.
这篇关于汇总前如何将两个量度相乘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文