Forum Discussion
Wrong subtraction results between two variables
- Anonymous1 year ago
Hi samoberoi
Thank you very much danextian for your prompt reply.
I did some testing and there doesn't seem to be anything wrong with your code. Running them individually gives the correct results, like this:
Do you want Subtraction_measure to display an equation? If so, you can use the following code:
Subtraction_measure = VAR A = CALCULATE( SUM('Table A'[Amount]), FILTER( 'Table A', ('Table A'[Country] = "England" && 'Table A'[LType] = "Type 2" && 'Table A'[Tax Plan] = "GT Free Tax") || ('Table A'[Country] = "Wales" && 'Table A'[LType] = "Type 2" && 'Table A'[Tax Plan] = "QT Free Tax") ) ) VAR B = [Test] VAR Result = B - A RETURN FORMAT(B, "0.00") & " - " & FORMAT(A, "0.00") & " = " & FORMAT(Result, "0.00")Here is the result.
If you still have questions, please provide your desired results. This is best presented in a table format.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi samoberoi
Thank you very much danextian for your prompt reply.
I did some testing and there doesn't seem to be anything wrong with your code. Running them individually gives the correct results, like this:
Do you want Subtraction_measure to display an equation? If so, you can use the following code:
Subtraction_measure =
VAR A =
CALCULATE(
SUM('Table A'[Amount]),
FILTER(
'Table A',
('Table A'[Country] = "England"
&& 'Table A'[LType] = "Type 2"
&& 'Table A'[Tax Plan] = "GT Free Tax")
||
('Table A'[Country] = "Wales"
&& 'Table A'[LType] = "Type 2"
&& 'Table A'[Tax Plan] = "QT Free Tax")
)
)
VAR B = [Test]
VAR Result = B - A
RETURN
FORMAT(B, "0.00") & " - " & FORMAT(A, "0.00") & " = " & FORMAT(Result, "0.00")
Here is the result.
If you still have questions, please provide your desired results. This is best presented in a table format.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.