Getting Percent Output for Expenses and Income

Skip to first unread message

Matthew C

Sep 14, 2020, 3:44:13 AM9/14/20
to Ledger

I am trying to calculate the percentage difference in my Income and Expenses.

For Example :

2,000.00 Expenses
2,600.00 Income

When I convert this into percentage using the -% it gives me

-320.91% Expenses
420.91% Income

Is there a way to fix this? I would prefer if I could get the percentage within 100%

Matthew C

Sep 14, 2020, 3:48:45 AM9/14/20
to Ledger
Part of the problem is that Expenses and Income are the two top level accounts and so (in my opinion) it is hard to get any sensible percentage values from them. If anyone here ans any solution for this. Please share

Thank You.

Eli Skeggs

Feb 22, 2022, 10:34:26 AMFeb 22
to Ledger
I'm running into something similar - I wanted to see what fraction of my income was going to taxes. It's not pretty, but this works:

ledger -f *.ledger bal --no-total expenses:tax income:earned --current --collapse 'abs(total)' --format '%(account) %(percent(display_total, + display_total))\n' | sed -n 's/^expenses/tax overhead/p'

This just gets me:
tax overhead nn.nn%

I'd love a better way to do this, though. It tries to divide by zero with --depth 2, and doesn't easily scale to more than just one output value.
Reply all
Reply to author
0 new messages