How to find Delta value between current period record and most recent period records.
Need you help in calculating the credit for sales rep month by month for Orders he is working on.
|Order#||Order Status||Initial Order Date||Order Change Date||Net Value||Delta||Payout|
|111||Initial Order||01-Jan-18||100||100||100||Jan Credit|
|222||Initial Order||01-Feb-18||20||20||20||Feb Credit|
I have created some sample data above for your reference
order 111# :
->Initial order came in the month of January and net value is 100 .100 value is considered for sales rep's commision calculation.
->There was a change in the order(order status is taken as reference) in the month of Feb. new net value is 150. So in this case Delta between the current net value and previous net value is considered for commision calculation.
->Then another changed record arrived in the month of April, So delta between April and the most previous period(Feb) is used for commision calculation.
Could you please help me to derivie this delta value between the current period and the most recent period of same orders.
The current period delta calculation should not impact any of the previos period's crediting and payout.