Char,
That is a great resource! Thanks for sharing. I will look into that for 
more customized reports than what I can get with Fava.

Dan,
Thanks! That works perfectly for me, given how I have my Expense accounts 
structured

On Sunday, March 12, 2023 at 7:23:23 AM UTC-7 dan...@grinta.net wrote:

> On 11/03/23 20:27, Daniel González wrote:
> > Hi,
> > I'm generating an income statement (with only my expenses) like this:
> > 
> > SELECT account, sum(position) FROM OPEN ON 2023-03-01 CLOSE ON 
> > 2023-03-30 WHERE account ~ "Expenses" GROUP BY 1 ORDER BY 1
> > 
> > But I have some subdivisions of my accounts that I would like to report 
> > one level up.
> > 
> > For example, now I get the following output:
> > 
> > ...
> > Expenses:Gifts:JohnDoe 50 USD
> > Expenses:Gifts:JaneDoe 25 USD
> > ...
> > 
> > And I would like to have:
> > 
> > ...
> > Expenses:Gifts 75 USD
> > ...
> > 
> > Is there a way to aggregate the accounts using beanquery?
>
> SELECT
> root(account, 2),
> sum(position)
> FROM ...
> WHERE
> root(account, 1) = 'Expenses'
> GROUP BY 1
> ORDER BY 1
>
> This aggregates all accounts to the second account name component, like 
> in your example. This requires that your account name structure is 
> somehow regular, if it is not, there is no way of doing what you want 
> with bean-query only.
>
> Cheers,
> Dan
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/bb6c6726-2809-4384-b225-6a97e4326429n%40googlegroups.com.

Reply via email to