首页 > 解决方案 > 两个矩阵列之间的差异出现两次(Power BI)

问题描述

我用两类数据之间的差异创建了一个新的度量;但是当我把它放在一个矩阵中时,这个信息会出现两次。

我有一个这种格式的数据库:

Type    Month   Item    Value
real    1   earnings    10
real    2   earnings    15
real    3   earnings    20
real    4   earnings    10
real    5   earnings    11
ppto    1   earnings    10
ppto    2   earnings    12
ppto    3   earnings    13
ppto    4   earnings    12
ppto    5   earnings    10

然后我创建了一个像这样的度量:

Difference =
CALCULATE ( SUM ( BASE[Value] ); BASE[Type] = "real" )
    - CALCULATE ( SUM ( BASE[Value] ); BASE[Type] = "ppto" )

问题是当我将新变量放入矩阵时,我得到了这个(重复两列差异):

矩阵数据

表格1

但我想在一列中得到结果。像这样:

表 2

我怎样才能解决这个问题?

标签: powerbidax

解决方案


这是因为您Tipo在该Columns字段中有多个值。

一种可能的解决方案是Tipo从列中删除并使用三个度量。

real = CALCULATE ( SUM ( BASE[Value] ); BASE[Type] = "real" )
ppto = CALCULATE ( SUM ( BASE[Value] ); BASE[Type] = "ppto" )
Difference = [real] - [ppto]

推荐阅读