BQL: select only 1st level accounts

41 views
Skip to first unread message

nug get

unread,
Jan 13, 2022, 12:18:16 PM1/13/22
to Beancount
Dear all,
I'd like to make expenses statements on my 1st level accounts, e.g. accounts that look like "Expenses:Mainaccount" but none of their child accounts. This should sum up all the values of the individual child accounts.

The following query provides the total expenses of any leaf account, but not of the main accounts:

SELECT account, sum(position)
WHERE account ~ 'Expenses:[^:]*'
ORDER By account DESC

How do i need to modify this above query in order to get the balances of the main accounts?

Thanks!
nugget

Patrick Ruckstuhl

unread,
Jan 13, 2022, 12:42:14 PM1/13/22
to bean...@googlegroups.com

Try something like

select root(account, 2), sum(position)


or if you need more things you can also do a group by root(account, 2)

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/cf33013e-dac9-430a-bea1-e5ec6d53d296n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages