> On Sat, Dec 1, 2018 at 11:23 AM Zhuoyun Wei <
wzy...@wzyboy.org> wrote:
>
> 2018-11-29 21:38:57 Justus Pendleton <
just...@gmail.com>:
> > On Friday, November 30, 2018 at 7:27:11 AM UTC+7,
mpl...@gmail.com wrote:
> >
> > Let say i have transactions going into account Expenses:Rent, and i would like 60% of total go to
> > Expenses:Rent:Personal and 40% to Expenses:Rent:Business,
> > what's the best way to do it?
> >
> >
> > I think the best way is to just be explicit and write: $600 to one and $400 to the other.
> >
> > If you really want to though, beancount supports simple math expressions so you can write:
> >
> > Expenses:Rent:Personal (1,000 * 0.6) USD
> > Expenses:Rent:Business (1,000 * 0.4) USD
> >
> TIL Beancount supports basic math expressions!
>
> I have quite a lot of transactions that need to be split by ratio
> (shared expenses with roommates). Each time I have to calculate the
> shares myself and fill in the result. This is lifesaver!
>
>
> If you have a really specific need you could also write a plugin.
> I do that for sharing expenses, e.g. I trigger filling off of a tag.
> IIRC Ledger supports % as amounts, but I've never looked at how it actually works.
> One way it could make sense would be to sum up the postings with non-% amounts, and fill in - like when you omit the
> amount - with the % of the remainder. We'd have to also check that the amounts sum up to 100% (or rely on the balance
> to fail).
> Anyhow, I don't think it's a super common usage, and using ratios as you suggested works well.
>
I had always thinking about writing my own plugins. But I prefer to
keep my repo in a self-contained way. That is to say, I do not want to
to put my plugin outside the repo. So I am counting on this issue to be
Currently the new discovery of math expressions in Amount helps a lot. I