Misc Costs totaling 3 times on invoice

I am attempted to show the total of the misc costs on an invoice.  I have created a calculated field for the misc costs that is equal to the extinvmisc only when the linetype is <> 1.  This does calculated correctly, but when I use a sum formula it is three times the correct amount.

Any Ideas?