It sounds as though the subtotal formula is in your Page Footer, not the Report Footer.
These are two separate Sections in your report definition.
Page footers appear on every page.
Report footers appear at the end of the report.
An invoice is basically a report for one invoice number.
Hope that helps.