Forum Discussion
fxz9
8 years agoFrequent Visitor
table Calculate for sum field operation
Source Data Example
| item | amount |
| AA | 10 |
| AA | 5 |
| BB | 3 |
| BB | 3 |
after powerBI by summrize by item (categray)
item Sum
| AA | 15 |
| 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.
| AA | 15 |
| BB | 6 |
| AA-BB | 9 |
I'm not sure how to implement an operation for sum measure.
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" ) )Best regards,
Yuliana Gu
2 Replies
- v-yulgu-msft
Microsoft 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" ) )Best regards,
Yuliana Gu
- fxz9Frequent Visitor
Thanks for you replay