I created a calculated column and measure. They should bring same result. But when creating visuals I get different view.
My calculated column:
if [CostPrice] = null then 0 else [AmountWithDiscount] - [CostPrice]
And visual with this column:
When I try to do the same thing with measure it turns out differently. My measure:
_surcharge = IF(SUM(CheckLines[CostPrice])= BLANK(), 0, SUM(CheckLines[AmountWithDiscount]) - SUM(CheckLines[CostPrice]))
Visual with this measure:
It seems to me that logically these two visuals should be the same.
The calculated column is evaluated and calculated for each row, while the measure is evaluated once for all the rows that are in the context.
This is an important difference that might explain the different numbers that you are getting: