I'm not sure I follow all you want to do here. The If function you've posted just replaces the value of Units with zero if the current date doesn't fall in the specified range. Presumably a summary field or possibly a related record with a Sum calculation then totals the units for all such records?
There are other approaches that do not use a calculaiton field at all, but instead use either a find or a relationship to produce a total for records dated in a specified date range. Does that sound like something that would work for you? If so, we'd need a more detailed description of how your table is set up and the type of report and/or layout you want here.
Just modifying your given function to do exactly what you requested would change it to:
Case ( InvoiceDate >= Date ( 7;1;Year(Get (CurrentDate) )) and InvoiceDate <= Get (CurrentDate) ; Units; 0)
(Case and If can be used interchangeably if there are only two outcomes possible from a single boolean expression such as this.)