I have a table which has a cost and cost adjustment per month for contracts. Once a contract is finished it won’t appear in future months. So I am using the following formula to get the last reported value

```
Estimated Cost @@ Completion - Last Reported =
```

var minDate = MIN(‘Calendar’[Date])

var totalCost = CALCULATE (

(SUM ( ‘Work In Progress’[Cost] ) + SUM(‘Work In Progress’[CostAdjustment])),

LASTNONBLANK ( FILTER(ALL(Calendar[Date]), ‘Calendar’[Date] <= minDate), CALCULATE ( SUM ( ‘Work In Progress’[Cost] ) + SUM ( ‘Work In Progress’[CostAdjustment] ) ) )

)

return totalCost

The formula seems to be working correctly fro each month however in the total of the table it doesn’t add up correctly.

Any help would be greatly appreciated.