Budget formulas
Reference
Every number in your budget, as Balanced calculates it.
These are the rules behind the budget editor and the Budget section of the journal overview. Balanced calculates each month on its own, in order, starting from what the month before left behind. “Today” means today’s date on your device. Why the rules are the way they are is explained in Zero-based budgeting, Month to month and Credit cards and debt.
Available
Section titled “Available”The money you can budget this month:
Available = cleared income dated today or earlier + Assets postings of transactions with an Equity account + money paid into Assets from a liability- Income counts once it’s Cleared and its date has come. Uncleared income and income dated after today don’t count yet.
- Opening balances and corrections count as soon as you enter them, cleared or not, whatever their date in the month. A correction that lowers an asset account lowers Available.
- A loan paid into an asset account counts as soon as you enter it, cleared or not, whatever their date in the month. Only money going into Assets counts: paying off a card or a loan doesn’t lower Available.
- Each month only counts its own transactions. Money you didn’t assign reaches the next month through the carry-over, not through Available.
Assigned
Section titled “Assigned”The total of the amounts you’ve entered in the budget editor for this month, for categories and liabilities alike.
To assign
Section titled “To assign”To assign = Available − Assigned + carry-over- Above zero: the overview shows Ready to assign, the budget editor To assign.
- Below zero: the overview and the bar at the bottom of the budget editor show Overassigned.
- Zero: the row disappears from the overview. In the current month, confetti falls in the budget editor.
Carry-over
Section titled “Carry-over”What last month left behind. The budget editor shows it under Available: as Remaining last month if it’s zero or more, as Overspent last month if it’s below zero.
carry-over = last month's To assign − last month's overspending + card spending last month that wasn't covered- Overspending is the sum of all categories and liabilities that ended last month below zero.
- Card spending that wasn’t covered is the not covered amount from Paying by card. It’s added back, because it’s still owed on the card and hasn’t left your accounts, so it doesn’t lower this month’s To assign. Everything else that left a category below zero does, such as spending from Checking or in cash.
- Last month’s To assign includes its own carry-over, so money you don’t assign keeps moving forward, month after month.
- The first month with transactions has no carry-over.
Category balance
Section titled “Category balance”For each expense account:
category balance = max(0, balance at the end of last month) + assigned this month − spent this month- Spent this month is everything booked on the category this month and dated today or earlier, cleared or not, however you paid. A refund booked on the category gives the money back.
- A positive balance carries over into the next month. A negative one doesn’t: an overspent category starts the next month at 0, and the shortfall comes off To assign through the carry-over.
- Below zero, the category is Overspent.
Available in a category
Section titled “Available in a category”available in a category = category balance − plannedPlanned is what’s booked on the category this month with a date after today. The colors of the result are listed in Colors and status.
Paying by card
Section titled “Paying by card”Balanced goes through the month’s transactions dated today or earlier in order of date and time. For each purchase paid by card:
covered = min(purchase, left in the category right before it)not covered = purchase − covered- Left in the category is its balance at that moment: what it carried over and was assigned this month, minus everything spent from it earlier this month, by card or not. It’s never counted as less than 0.
- Paid by card means the purchase makes what you owe on a Liabilities account grow. If one transaction uses several cards, each counts with its own amount. If you pay partly by card and partly from Checking, the card part comes first.
- The covered part is set aside for the card (see below).
- The category always loses the full purchase, so it can still end up Overspent.
- The part that isn’t covered stays on the card as debt. It’s added back in next month’s carry-over, so it doesn’t lower your To assign.
Two card purchases of €80 with €100 in Groceries: the first is covered in full. The second finds €20 left, so €20 is covered and €60 isn’t. The card gets €100 set aside, and Groceries ends at −60.
A refund to the card gives the money back to the category. On the card’s side, it first cancels that card’s spending in the same category this month that wasn’t covered. Only the rest lowers what’s set aside for the card.
Set aside for a liability
Section titled “Set aside for a liability”What’s ready to pay a credit card or loan, shown in the Liabilities section of the budget editor:
set aside = max(0, set aside at the end of last month) + assigned this month + covered this month − refunds to the card − repayments- Refunds to the card count here only with what’s left after they’ve cancelled uncovered spending (see above).
- A repayment is money paid from an Assets account into a Liabilities account, dated today or earlier. Other lines in the same transaction, such as the interest in a loan installment, are ordinary spending from their categories.
- If you pay more than was set aside, or a refund to the card is larger than what’s set aside, the result goes below zero. Like an overspent category, the liability starts the next month at 0, and the difference comes off To assign once, through the carry-over.
- The monthly summaries in transaction lists show repayments as Liability repayment. The Cash Flow chart uses the same name for how much your debts went down overall: see Charts.
Spent and Planned spending
Section titled “Spent and Planned spending”Spent = category spending dated today or earlier
Planned spending = category spending dated after today- Both only count this month, cleared or not.
- A card purchase counts once, when you make it. Paying the card or a loan isn’t spending: you see it on the liability’s row in the budget editor (“Repayment of …”), in the monthly summaries and in the Cash Flow chart.
Under the hood · for the curious
All of these rules live in one file of the app’s source code, Models/BudgetCalculation.swift. It goes through your months from the oldest to the newest and works out each one from the month before.
An example, with every euro assigned in October:
October Fun: assigned 100, spent 130 from Checking Groceries: assigned 100, spent 80, then 50, by card Card: covered 80 + 20, not covered 30
November carry-over = 0 (To assign) − 30 − 30 (overspent) + 30 (not covered by card) = −30November shows Overspent last month −30: the overspending in Fun, paid from Checking. The €30 that Groceries couldn’t cover is still owed on the card.
