HAVING STATEMENT error SQL command not properly ended
The HAVING clause is the cause of the error as it not syntactically correct. You have (added parentheses to show how it is parsed):

HAVING (SUM(..) BETWEEN x AND y) = 0 


and the expression inside the parentheses returns a boolean result.

Additionally, the SUM(INV.INVDATE) doesn't make much sense. What result should one expect if we add dates?

And as @mustaccio correctly noticed, the HAVING clause goes after GROUP BY, not before.



It seems you want something like this in the HAVING clause:

HAVING SUM(CASE WHEN TO_DATE(INV.INVDATE) BETWEEN TO_DATE('01-Oct-13') 
                                              AND TO_DATE('30-Sep-15') 
           THEN INV.SALES ELSE 0 
           END) = 0


which I would prefer rewritten as:

HAVING SUM(CASE WHEN INV.INVDATE &gt;= DATE '2013-10-01' 
                 AND INV.INVDATE &lt; DATE '2015-10-01' 
             THEN INV.SALES ELSE 0 
           END) = 0


The INV.INVDATE should be removed from the GROUP BY clause as well and the TWO_YEARS and PROGRESS expressions should also be corrected as the  SUM(...) expression suggested SUM(CASE WHEN ... THEN x ELSE y END) instead of CASE WHEN ... THEN SUM(x) ELSE y END.