Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
fxz9
Frequent Visitor

table Calculate for sum field operation

Source Data Example

 

itemamount
AA10
AA5
BB3
BB3

 

after powerBI by summrize by item (categray)

 item       Sum

AA15
BB

6

 

 

I hope power bi can show the result as Sum(AA)-Sum(BB)

In tableau ,I can using table calucation funcion to do that.

 

AA15
BB6
AA-BB9

 

I'm not sure how to implement an operation for sum measure.

 

 
1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @fxz9,

 

Power BI doesn't support that. As a workaround, you can show the difference in an extra column. Please refer to below measure:

AA-BB =
CALCULATE (
    SUM ( Table1[amount] ),
    FILTER ( ALL ( Table1 ), Table1[item] = "AA" )
)
    - CALCULATE (
        SUM ( Table1[amount] ),
        FILTER ( ALL ( Table1 ), Table1[item] = "BB" )
    )

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @fxz9,

 

Power BI doesn't support that. As a workaround, you can show the difference in an extra column. Please refer to below measure:

AA-BB =
CALCULATE (
    SUM ( Table1[amount] ),
    FILTER ( ALL ( Table1 ), Table1[item] = "AA" )
)
    - CALCULATE (
        SUM ( Table1[amount] ),
        FILTER ( ALL ( Table1 ), Table1[item] = "BB" )
    )

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for you replay

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.