简体   繁体   中英

Difference between two matrix columns appears two times (Power BI)

I created a new measure with the difference between two categories of data; but when I put it in a matrix, this information appears two times.

I have a database with this format:

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

then I created a Measure like this:

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

the problem is when I put the new variable in a Matrix, I obtain this (repeated two columns of differences):

矩阵数据

表格1

but I would like the result in one column. Like this:

表2

How can I fix this?

This is because you have Tipo in the Columns field and that has multiple values.

One possible solution is to remove Tipo from the columns and use three measures.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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