as ai stated before your formual is only evalauting on the last row of data for the group, it is not a per row condition.
In order to to that you have to use shared variables (per row) or running totals with evaluation formulas.
I think you want something more along the lines of 3 formulas,
one to set the value to 0 in the gh
a second to add your values
and a 3rd to display the final sum in the gf
I think you are trying to do all 3 in one formula
gh
Shared NumberVar Offset;
Offset := 0
detail
Shared NumberVar Offset;
Offset := offset + (If {ELaborDist.cd} = "D" Then {ELaborDist.amount})
gf
Shared NumberVar Offset;
Offset := offset *-1
offset