I'm trying to write a code to find the acct balance at the time a specific transaction was applied in history. My transactions table doesn't include the balance, it only includes the charges and payments in one column as transactions.

for example the balance today is $3000, I would like to know what was the balance before a pyment was made 5-6 months ago. Do I need to add all the payments and subtract all the charges in the last 5-6 months to find what was the balance at that point? Is there an easier way?