hi Anne Ong,
1. Create a new formula variable with customer exit processing type.
2. Derive month number in comd code from user input as below
l_s_range = sy-datum+4(6).
3. Then Average month unit = YTD units * formula variable.(As arvind said)
Regards,
Sreekanth