For this purpose, I use balance with the --group-by option, like this: ledger balance Expense:Entertainment --depth 2 --group-by 'format_date(date, "%Y-%m")'
That would produce a series of balances grouped by month. You could also use "%Y" as the format string to get grouped by year, or many other things. -Mythmon On Thu, May 14, 2020 at 1:44 PM MN <[email protected]> wrote: > Hi, > > Say I have the account Expense:Entertainment. > > Under it I have: > > Expense:Entertainment:Movies > Expense:Entertainment:Travel > Expense:Entertainment:Hobbies > > I want a report of how much I spent on Expense:Entertainment overall for > each year. It shouldn't show me all the subaccounts, but their amounts > shouldn't be ignored. > > So if, for 2019, Expense:Entertainment had $100 and the other three > categories each had $50, it should show it as $250 for > Expense:Entertainment for the whole year. > > I can't seem to find a way to do this in Ledger. I've tried: > > ledger -Y reg "^Expense:Entertainment$" --period-sort "(amount)" > > But this gives just the amounts in Expense:Entertainment > > I also tried: > > ledger -Y reg ^Expense:Entertainment --depth 2 --period-sort "(amount)" > > This is a bit better, but it doesn't quite do it. In the first column it > shows only the amount for Expense:Entertainment. In the second column it > has all the subaccounts, but the problem is it is cumulative: > > 15-Jan-01 - 15-Dec-31 Expense:Entertainment 4.30 USD > 402.92 USD > 16-Jan-01 - 16-Dec-31 Expense:Entertainment 1233.76 USD > 2687.10 USD > 17-Jan-01 - 17-Dec-31 Expense:Entertainment 80.23 USD > 2800.33 USD > 18-Jan-01 - 18-Dec-31 Expense:Entertainment 9.89 USD > 2949.82 USD > > Also, just on the side - I noticed this command: > > ledger reg Expense:Entertainment --depth 2 --period yearly > > Gives slightly different values in the second column. Not sure why. > > The other problem with this is that it starts in 2015, when I have entries > prior to 2015 (but they appear only in subaccounts, and not the parent > Expense:Entertainment account). > > Any help would be appreciated. > > -- > > --- > 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/6ec1ac43-7bf6-4f3f-b104-eb9b6989bcc8%40googlegroups.com > <https://groups.google.com/d/msgid/ledger-cli/6ec1ac43-7bf6-4f3f-b104-eb9b6989bcc8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- --- 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/CAFOMguZmSxxj5U-yS3NtJh634Nx56%3D1XMyQ6dhoiam%2B6-Z%3DCvA%40mail.gmail.com.
