Calculate Monthly Interest on a Reducing Balance in Excel Power Query
Question details
Calculate monthly interest in Power Query using a balance that changes after each deduction.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- Monthly deductions run from July through the following June, and each month's interest must use the current balance.
- Observed behavior
- The desired result is a monthly schedule showing interest and the updated balance after each deduction.
Prepare one row per month with a date and a deduction amount, and determine the opening balance and annual interest rate. Confirm whether interest is added before or after each deduction; the example below adds interest first.
Build a Reducing-Balance Schedule with Power Query
Use a running calculation when each month's opening balance depends on the previous month's closing balance.
This example assumes a nominal annual rate divided by 12, monthly compounding, and deductions made at the end of each month. It does not round intermediate amounts.
The query sorts actual dates in ascending order, so July through June must use the correct years. It calculates interest on the opening balance, then adds that interest and subtracts the deduction.
In Excel, enter two columns named Month and Deduction, with one row per month. Use actual dates for Month and positive numbers for Deduction. Select the data, choose Insert > Table, and name the table MonthlyDeductions on the Table Design tab.
Choose Data > Get Data > From Other Sources > Blank Query, then select Home > Advanced Editor in Power Query.
Replace the editor contents with the following code. Change OpeningBalance and AnnualRate to your values; 0.06 represents 6% per year. let Source = Excel.CurrentWorkbook(){[Name="MonthlyDeductions"]}[Content], Typed = Table.TransformColumnTypes(Source, {{"Month", type date}, {"Deduction", type number}}), Sorted = Table.Sort(Typed, {{"Month", Order.Ascending}}), OpeningBalance = 10000, AnnualRate = 0.06, Rows = List.Accumulate( Table.ToRecords(Sorted), {}, (state, current) => let Balance = if List.IsEmpty(state) then OpeningBalance else List.Last(state)[ClosingBalance], Interest = Balance * AnnualRate / 12, Closing = Balance + Interest - current[Deduction] in state & {[Month = current[Month], Deduction = current[Deduction], OpeningBalance = Balance, MonthlyInterest = Interest, ClosingBalance = Closing]} ), Result = Table.FromRecords(Rows, type table [Month = date, Deduction = number, OpeningBalance = number, MonthlyInterest = number, ClosingBalance = number]) in Result
Select Done, check that each OpeningBalance matches the preceding ClosingBalance, and choose Home > Close & Load to return the results to Excel.

Calculate a Reducing Balance in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Excel format compatibility for an easy transition. It does not fix Excel Power Query, but you can build a similar monthly interest schedule with worksheet formulas in WPS Spreadsheets.

Frequently Asked Questions
Why can't I calculate every month's interest from the original balance?
After each deduction, the closing balance changes. The next month's interest should use that closing balance as its opening balance, rather than repeatedly using the original amount.
How do I change the annual interest rate?
Open the query in Power Query, select Home > Advanced Editor, and change the AnnualRate value. For example, use 0.05 for 5% per year. The example divides that rate by 12.
What if the deduction is made before interest is calculated?
In Advanced Editor, calculate interest on Balance minus current[Deduction], then calculate Closing as Balance minus current[Deduction] plus Interest. Confirm that this matches your payment terms.
How can I keep July through June in the correct order?
Enter actual dates with the correct years in the Month column. The query sorts those dates in ascending order, placing July before the following June.
Can I calculate the schedule without Power Query?
Yes. In a spreadsheet, calculate each month's interest from its opening balance, add interest, subtract the deduction, and use the resulting closing balance as the next month's opening balance.




