[hledger] Envelope Budgeting from Multiple Accounts


I'm trying to figure out a good way to handle "envelope style" budgeting in the case where I might pay groceries from two different credit cards, that are paid from different real-world bank accounts.

Previously, I was using "real" accounts to handle the budget, with specific budgets as sub-accounts, such as assets:bankX:checking:groceries.

But that doesn't really work when my expenditures for groceries might be coming out of different accounts (for example, assets:bankX and assets:bankY and in ways that aren't predictable or even.

Example of How I was doing it Previously

expenses:groceries                        50.00
assets:bankX:checking:groceries          -50.00
assets:bankX:checking:pending:cardX       50.00

But with having potentially "groceries" being handled by two different bank accounts, I was wondering if anyone has done something similar using virtual postings to track the envelope budgets? I was trying to do some digging to find examples, but couldn't find anything that matched this situation.

Would a way be to basically make virtual asset accounts like the expenses accounts?

Example of What I think might work, but want feedback on

expenses:groceries                    50.00
(assets:groceries)                   -50.00
assets:bankX:checking:pending:cardX   50.00

Or, if anyone has a different suggestion about how to do it, that is more than welcome as well. I'm just wondering if my normal reporting (I pretty much just use heldger bs --tree to check amounts remaining in the "envelopes" and make sure my accounts have enough to pay off the card payment) will still work with that system?

And yes, I know I could just make my cards autopay from the same bank accounts, but that isn't a great solution given the rest of the circumstances not necessarily relevant to this minimal example.



When I was in that situation, I had one checking account where my budget envelopes lived. And when I had to spend from a different account, I would also make an adjustment to the appropriate envelope, transferring an equal amount out, eg from checking:food, to the (non-budget) checking:available account. Verbose but correct!

1 Like

The way i do budgeting is by creating virtual liabilities and using
automatic transactions to subtract from them when i create a new
expense. For example:

2024-04-01 Budget: April 2024
    (liabilities:budget:rent)                    $-1500
    (liabilities:budget:food)                     $-500
    (liabilities:budget:clothing)                 $-100
    (liabilities:budget:transportation)           $-200
    (liabilities:budget:misc)                     $-500

Then an automatic transaction looks like - for food -

= /expenses:food/ and expr date >= [2024-04-01] && date < [2024-05-01]
	(liabilities:budget:food)  1.0

Then to see how much money i have available after budgeting i just do:

ledger bal assets liabilities

And to see how much money i actually i have, i just take out the virtual transactions:

ledger bal assets liabilities --real

An example:

1 Like

It might not be your cup of tea, but I will show what I do just in case you might find it useful. A plain budget transaction at the beginning of the month

~ monthly from 2024/01
    Expenses:Food    4¤
    Expenses:House  32¤

and then

hledger balance -p thismonth --budget ^Expenses

gives a nice enough summary.

Originally the envelope approach used cash, which has its benefits as it gives you a hard, tactile limit on what you can spend. I still use it now and then for unnecessary expenses, like having fun out with friends.

1 Like