# 50% of the balance?

**URL:** https://forum.plaintextaccounting.org/t/50-of-the-balance/461
**Category:** General
**Tags:** hledger
**Created:** [January 9, 2025, 7:08pm UTC](https://forum.plaintextaccounting.org/t/50-of-the-balance/461 "2025-01-09T19:08:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adept](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/adept/32/36_2.png) [@adept](https://forum.plaintextaccounting.org/u/adept)
#### Post date: [January 9, 2025, 7:08pm UTC](https://forum.plaintextaccounting.org/t/50-of-the-balance/461/1 "2025-01-09T19:08:24Z")

</div>

I am trying to create a report that will help me with my tax work. I am importing CSV statements from banks, which give me gross interest for my savings accounts.

Some of those accounts are mine alone, and I am liable for tax on all gross interest. Some, however, are joint, and I am liable for tax on just half of gross interest. Interest transactions are (of course!) not split by bank 50/50; they are often just one lump sum arriving in a single transaction.

I am trying to figure a way to get a report that gives me "the balance of all interest transactions in those accounts, and half of the balance in those other accounts", and I am trying to keep it simple.

My "plan B" is to either write a small haskell script that uses hledger-lib or a small python script that post-processes the output of "hledger balance". Both of these options make me a bit sad.

I wonder if anyone has done anything similar in the past?

---

<div class="post-metadata">

### Author: ![simonmic](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/simonmic/32/1_2.png) [@simonmic](https://forum.plaintextaccounting.org/u/simonmic)
#### Post date: [January 9, 2025, 7:38pm UTC](https://forum.plaintextaccounting.org/t/50-of-the-balance/461/2 "2025-01-09T19:38:53Z")

</div>

I found a way to do it with auto postings:

```auto
$ hledger bal revenues:interest
             $ -0.96 JS:revenues:interest
             $ -0.37 sm:revenues:interest
--------------------
             $ -1.33  

```

To halve just the JS total, add this rule somewhere in the journal:

```auto
= JS:revenues:interest
    (JS:revenues:interest) *-.5

```

And activate it with --auto:

```auto
$ hledger bal revenues:interest --auto
             $ -0.48 JS:revenues:interest
             $ -0.37 sm:revenues:interest
--------------------
             $ -0.85  

```

I tried at first to supply the rule as an extra file, eg with `-f <(printf ...)` on the command line, but found [auto posting rules don't affect sibling files · Issue #1212 · simonmichael/hledger · GitHub](https://github.com/simonmichael/hledger/issues/1212), unfortunately.

PS: here's a one-liner that works:

```auto
printf "= JS:revenues:interest\n (JS:revenues:interest) *-.5\ninclude $LEDGER_FILE\n" | hledger -f- --auto bal revenues:interest

```

---

<div class="post-metadata">

### Author: ![adept](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/adept/32/36_2.png) [@adept](https://forum.plaintextaccounting.org/u/adept)
#### Post date: [January 9, 2025, 9:08pm UTC](https://forum.plaintextaccounting.org/t/50-of-the-balance/461/3 "2025-01-09T21:08:36Z")

</div>

Thank you very much, this seems to be exactly what I want
