How to add previous due automatically?

How to add previous due automatically?

i want to add my previous invoice due of a particular customer automatically to the new invoice. 

i want to show something like that:
%InvoiceTotal% (current invoice's total)
%PreviousBalance% (customer's outstanding balance due from previous invoice)

%TotalBalanceDue% (current invoice + unpaid previous invoice= Total)

Right now i can only get their outstanding balance to show up if i manually add it.