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, -parent.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. On Monday, September 14, 2020 at 12:48:45 AM UTC-7 [email protected] wrote: > 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. > > > On Monday, September 14, 2020 at 2:44:13 PM UTC+7 Matthew C wrote: > >> Hi, >> >> I am trying to calculate the percentage difference in my Income and >> Expenses. >> >> For Example : >> >> 2,000.00 Expenses >> 2,600.00 Income >> ------------------------------ >> 600.00 >> >> 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% >> >> -- --- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/820e6e92-cbdb-4c7d-be25-f4e38dcd20e0n%40googlegroups.com.
