The aggregate functions that apply to a group of rows (GROUP COUNT, GROUP PERCENT, GROUP SUM, GROUP AVG, GROUP MIN, and GROUP MAX) can only be used at the point in the report when a complete group has been processed, namely, in the AFTER GROUP control block. Make sure that the AFTER GROUP statement exists and was recognized. If you need the value of a group aggregate at another time (for instance, in a PAGE TRAILER control block), you can save it in a global variable with a LET statement in the AFTER GROUP control block.