Forum Discussion

Jinxz_21's avatar
Jinxz_21
Regular Visitor
3 years ago
Solved

power bi desktop getting difference with calculate

can someone help me with this

Get_Diff = 
VAR __a = CALCULATE(SUM('sales'[Qnty]),'sales'[Year]=2022) // value = 5
VAR __b = CALCULATE(SUM('sales'[Qnty]),'sales'[Year]=2021) // value = 10
VAR __c = CALCULATE(__a - __b) //should be c = -5
return
__c

on visual matrix
2021 display -5 instead of 5
2022 display 10
Get_Diff = -5


if i change VAR __c = CALCULATE(__a + __b)
on visual matrix
2021 display  5
2022 display 10
Get_Diff = 15


how can i make 2021 display to a positive number when getting the difference

2 Replies