How to split expenses on a regular basis

160 views
Skip to first unread message

freak...@gmail.com

unread,
May 22, 2019, 11:43:52 AM5/22/19
to Beancount

Hi,

I'm new to beancount and currently assessing whether I can switch from ledger-cli in order to make use of the web interface fava.

I'm interested in ways on how to split expenses in beancount: I share a household with my partner and for many expenses I'd like to register only half the debit as a personal expense whereas the other half should be registered as an asset (something that my partner owes me).

I currently use ledger-cli and make heavy of the following automatic transaction to split transactions with my partner:
= tag("With") =~ "Susa"
    $account                                    
-0.5
   
Assets:Receivable:Susa                       0.5

Shared expenses are then recorded like this:
2019/05/22 * Bakery
   
Expenses:Food                          10.00 EUR ; With: Susa
   
Assets:Cash

This results in a credit of 5.00 EUR to Expenses:Food and Assets:Receivable:Susa each. I find this quite comfortable and want to know if there is something similar in beancount. (I've already learned that there are no automatic transactions in beancount)

I skimmed the documentation of beancount for sharing expenses and what I found seems to involve "special" accounts (e.g. Expenses:Food:Fred & Expenses:Food:Susa) in order to split transactions using a plugin ("beancount.plugins.split_expenses") -- is this correct?

Does the mentioned plugin work in way like the automatic transaction in ledger-cli does, i.e. does running beancount automatically split the written amount in the journal file or does the workflow involve running a command that results in hard-coded input text that replaces the original input data?

More generally: How do beancount users normally record regular shared expenses?

Thanks and regards,
Fred

Michael Budde

unread,
May 22, 2019, 1:51:51 PM5/22/19
to bean...@googlegroups.com
Hi Fred

I use a solution similar to yours for sharing expenses with my partner in ledger-cli. For beancount I have made a (very simple) plugin that does pretty much the same. I have attached the plugin which you might find useful. It is used like this:

plugin "bc_plugins.split_expenses" "Assets:Receivable"

2019/05/22 * Bakery
    Expenses:Food                          10.00 EUR split: "Susa"     Assets:Cash
The plugin transforms the transaction into the following:
2019/05/22 * Bakery
    Expenses:Food                           5.00 EUR
    Assets:Receivable:Susa                  5.00 EUR
    Assets:Cash

Regards,
Michael
--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

split_expenses.py

Zhuoyun Wei

unread,
May 23, 2019, 1:06:29 AM5/23/19
to Beancount
I do this for shared expenses:


2019-01-01 * "Rent"
Liabilities:Bank:CreditCards -8000.00 CNY
Expenses:Household:Rent 8000.00 / 2 CNY
Equity:ARAP:JohnDoe 8000.00 / 2 CNY


With some importer and editor tricks, you can somehow automate this.


--
Zhuoyun Wei

On Wed, May 22, 2019, at 11:43, freak...@gmail.com wrote:
>
> Hi,
>
> I'm new to beancount and currently assessing whether I can switch from
> ledger-cli in order to make use of the web interface fava.
>
> I'm interested in ways on how to split expenses in beancount: I share a
> household with my partner and for many expenses I'd like to register
> only half the debit as a personal expense whereas the other half should
> be registered as an asset (something that my partner owes me).
>
> I currently use ledger-cli and make heavy of the following automatic
> transaction to split transactions with my partner:
> `
> = tag("With") =~ "Susa"
> $account -0.5
> Assets:Receivable:Susa 0.5
> `
>
> Shared expenses are then recorded like this:
> `
> 2019/05/22 * Bakery
> Expenses:Food 10.00 EUR ; With: Susa
> Assets:Cash
> `
>
> This results in a credit of 5.00 EUR to Expenses:Food and
> Assets:Receivable:Susa each. I find this quite comfortable and want to
> know if there is something similar in beancount. (I've already learned
> that there are no automatic transactions in beancount)
>
> I skimmed the documentation of beancount for sharing expenses and what
> I found <http://furius.ca/beancount/doc/shared> seems to involve
> "special" accounts (e.g. Expenses:Food:Fred & Expenses:Food:Susa) in
> order to split transactions using a plugin
> ("beancount.plugins.split_expenses") -- is this correct?
>
> Does the mentioned plugin work in way like the automatic transaction in
> ledger-cli does, i.e. does running beancount automatically split the
> written amount in the journal file or does the workflow involve running
> a command that results in hard-coded input text that replaces the
> original input data?
>
> More generally: How do beancount users normally record regular shared expenses?
>
> Thanks and regards,
> Fred
>
> --
> You received this message because you are subscribed to the Google
> Groups "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to beancount+...@googlegroups.com.
> To post to this group, send email to bean...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/e413816b-57be-439b-ae24-fd33efbbaf8a%40googlegroups.com <https://groups.google.com/d/msgid/beancount/e413816b-57be-439b-ae24-fd33efbbaf8a%40googlegroups.com?utm_medium=email&utm_source=footer>.

freak...@gmail.com

unread,
May 23, 2019, 3:15:55 AM5/23/19
to Beancount

Hi Michael,

your plugin seems to fit the bill -- I'll try it out, thank you very much!

Regards,
Frederik

Martin Blais

unread,
Jun 1, 2019, 12:26:04 AM6/1/19
to Beancount
Hi Fred,
Here's something I wrote not too long ago - that I  haven't published anywhere yet - which is related:

How We Share Expenses




--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.

Martin Blais

unread,
Jun 1, 2019, 12:26:42 AM6/1/19
to Martin Blais, Beancount

john8...@gmail.com

unread,
Jun 11, 2019, 12:36:05 PM6/11/19
to Beancount
Hi Martin,
Thanks for sharing this document.

You describe using the `beancount.plugins.divert_expenses` plugin to split expenses in tagged transactions, but the plugin only appears to rename accounts rather than split postings.
There's the `beancount.plugins.split_expenses` plugin, but to my understanding it operates on a whole ledger and does not filter transactions by tags.
Additionally, in your example expenses are split 40/60, which as far as I can tell neither plugin can do at the moment.

Perhaps I've missed something...
Could you clarify at which point the transactions are split in your system?
To unsubscribe from this group and stop receiving emails from it, send an email to bean...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages