The ideal would be that on load (using the peek function), you would fill the missing values with the required figure and identify them using a certain flag (1 for filled, 0 for null)
Then, in the front-end, you would create expressions that would calculate the sum using set analysis for values Flag = 1.
That should give you both the required results to be displayed while giving you the correct sums.
That is the easiest solution that I can think of.
If you need more guidance, reach out.