Calculation of total amount at the end of a specific time period