Archived discussions are read-only. Learn more about SAP Q&A
Can I created Cumulative sum of salary based on Department Number but last row calculated only previous row only.
Custom function and Error attached as below.
This will work when you define $PREV_DEPT and $PREV_SAL as global variables instead of parameters (that are local to the call).
Make sure you initialise them properly before your first function call.