For footer create a window type "Final". Do the calculation in main window for the result or in initialization. Depending on your requirement.
add these condition to condition Tab under Final window.
SFSY-FORMPAGE = SYSY-FORMPAGES. (This will trigger only on last page)
You can check the same by putting default value .
Regards,
Rahul