Envelope budget entries / why do transactions have to balance to zero?

Cc-ing from hledger - Why do transactions have to balance to zero?:

I'm really confused about this, and nothing I've read has made things any clearer to me. For context, I use the envelope budgeting method. Let's say I have the following:

2024-09-01 Transaction
  liabilities:checking    $-10.00
  budget:food             $-10.00

Why does this need to balance to zero? I'm subtracting money from my checking account and also pulling it out of my food budget. The result is less money in both accounts, one real and one virtual. Can someone ELI5 why hledger wants this transaction to equal zero?

I'll give it a go (or at least, ELI15):

A balanced transaction

Your example entry is not complete, in double entry accounting terms. It's not clear what it means. Here's a conventional double entry for a food purchase:

2024-09-01 buy food
  assets:checking   $-10
  expenses:food      $10

(A checking account is an asset, not a liability, so I've corrected that.) This is a complete journal entry for a transaction, recording the source account and destination account of the money. (In double entry accounting, spending categories and income categories are also accounts.) By requiring the transaction's inflow(s) and outflow(s) to sum to zero, we can be sure all money moved is accounted for, without any disappearing into or appearing out of thin air.

A separate budget envelope

Separately, you are also wanting to keep track of the balance remaining in a budget envelope. "budget:food" is not part of the five standard account categories (assets, liabilities, equity, revenue, expenses), so in accounting terms it's imaginary. That's allowed, but this new budget:food posting needs something to balance it - a fourth (dummy) posting:

2024-09-01 buy food
  assets:checking   $-10
  expenses:food      $10
  budget:food       $-10
  budget used        $10

Or, less verbosely, you can mark it as an unbalanced posting exempt from double entry accounting, by parenthesising the account name (a special feature of ledger and hledger):

2024-09-01 buy food
  assets:checking   $-10
  expenses:food      $10
  (budget:food)     $-10

Integrated budget envelopes

There's another solution, which appears if you try to track things very literally and accurately (always a good tactic when things are unclear). Imagine you are doing actual envelope budgeting, and keeping your cash in physical envelopes. You'd have several assets:envelopes:* accounts representing these, and a food purchase would be

2024-09-01 buy food
  assets:envelopes:food  $-10
  expenses:food           $10

This records the source and destination of money, and also updates your budget envelope balance, at the same time (because the source is the budget envelope). The budget envelopes are integrated within your normal asset accounts.

You can use the same approach with a checking account. Your bank probably doesn't let you easily create actual checking subaccounts, but that's fine, they can exist only in your accounting system:

2024-08-31 fill budget envelopes for the coming month
  assets:checking
  assets:checking:food   $200
  assets:checking:rent  $1000
  ; etc.

2024-09-01 buy food
  assets:checking:food   $-10
  expenses:food           $10

In the real world, the food transaction's source is the checking account, but in your accounting the source is the (imaginary) checking:food subaccount. Accounting software like hledger, ledger and beancount will still show the correct balance for assets:checking, since they aggregate subaccount balances.

Updating integrated budget envelopes when spending from elsewhere

If you spend from a different checking account, cash, or a credit card, how can you update envelope balances ? You could maintain additional budget envelopes under those accounts, but that would be complicated. More simply, you could restrict yourself to spending mainly from the checking account.

Otherwise, you can add a pair of postings to update the budget envelopes, like this:

2024-09-01 buy food
  assets:cash           $-10
  expenses:food          $10
  ; deduct from food budget (return it to unbudgeted funds)
  assets:checking:food  $-10
  assets:checking        $10

Too much work ?

Some people use auto posting rules to automate adding budget-related postings.

If envelope budgeting is too much work or not the best fit, remember goal budgeting is an alternative.

Related

Looking for examples of budgeting with hledger I found this proposal Budgeting with hledger · GitHub, which i think is not linked in the PTA site.

AFAIK it is a "goal budgeting" proposal with virtual accounts. Thanks to virtual accounts, I can aggregate multiple expense accounts in a small number of budgeting virtual accounts. Advantages:

  • goal budgeting seems easier to me than envelope budgeting
  • i only want two budgets but i have mny more expense categories

It is what i am checking now...

Thanks - that one is linked at https://plaintextaccounting.org/Budgeting#envelope-budgeting-with-auto-postings as "Mykola Orliuk: Budgeting with hledger".

I think it's envelope budgeting, because it doesn't use bal --budget, and creates (imaginary) "envelopes" ?

1 Like

In fact, I think it is more "goal budgeting" instead of "envelope budgeting". But sometimes the difference between them is quite small...

Envelope budgeting pre-allocates funds for controlling spending, so some assets are assigned to envelopes and expenses charge the envelope accounts. However, goal budgeting defines goals for categories of expenses (or imaginary/virtual category of expenses) but there is no one previous pre-allocation of assets. IMHO, the pre-allocation of assets is the key difference between both methodologies. I see Mykola Orliuk's proposal one manual way to do something similar bal --budget does.

Fair enough, it's a bit hard to define a clear line between them..