Subtracting subtree values

59 views
Skip to first unread message

Dillan Chang

unread,
Aug 8, 2023, 3:18:44 PM8/8/23
to Ledger
Hello devs, long time user here. Thanks for maintaining this amazing repo.

Just one small question cause I tried looking in the manual to no success. Is it possible for balance to report the value of an account minus the values from the children?
For example, I have something like this.

2023-08-08 Example
Assets:Checking  $100
[Assets:Checking]  $-100
[Assets:Checking:Virtual-A]  $30
[Assets:Checking:Virtual-B]  $70
Income  $-100

If you run bal Assets, you currently get:
$100.00   Assets:Checking
$30.00       Virtual-A
$70.00       Virtual-B

But I would like to get something like this:
$0.00   Assets:Checking
$30.00       Virtual-A
$70.00       Virtual-B
where if you run bal Assets -R, you'd end up with
$100.00   Assets:Checking

Thank you

John Wiegley

unread,
Aug 12, 2023, 3:27:38 PM8/12/23
to Dillan Chang, Ledger
>>>>> "DC" == Dillan Chang <dilla...@gmail.com> writes:

DC> If you run bal Assets, you currently get:
DC> $100.00   Assets:Checking
DC> $30.00       Virtual-A
DC> $70.00       Virtual-B

You’d need to run:

ledger bal -T amount '^Assets$'

In order to report amounts, not aggregate totals, and to confine your report
to exactly the Assets account alone.

John

david kayal

unread,
Aug 12, 2023, 3:41:42 PM8/12/23
to Dillan Chang, Ledger
Why not use —collapse?

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/m21qg8f4eu.fsf%40newartisans.com.

John Wiegley

unread,
Aug 12, 2023, 4:57:45 PM8/12/23
to david kayal, ledge...@googlegroups.com, Dillan Chang
Won’t that option collapse the sub account balances into the parent?

John
Reply all
Reply to author
Forward
0 new messages