That's quite a feat, thanks! I am currently using beancount2 and fava (python3 -m pip install beancount fava). Is it possible to integrate this unreleased beanquery into this flow?
On Friday, January 21, 2022 at 1:51:33 PM UTC-8 [email protected] wrote: > On 21/01/2022 10:38, [email protected] wrote: > > No way to currently do it AFAIK. A HAVING clause > > <https://github.com/beancount/beancount/issues/114> is on the wish > list. > > See this comment > > < > https://github.com/beancount/beancount/issues/114#issuecomment-632815268>. > > Turns out that a naive implementation of HAVING was not very difficult > to put together https://github.com/beancount/beanquery/pull/22 > > This implementation is naive in the sense that the expression in the > HAVING clause is computed from scratch instead than trying to reuse > aggregate expression computed as part of the SELECT. However, this is > not an optimization that is done in other parts of BQL either. > > Given an implementation of an empty() function that checks whether an > inventory is empty https://github.com/beancount/beanquery/pull/21 you > can write: > > SELECT > last(date) as date, > leaf(account) as account, > sum(position) as outstanding > WHERE > root(account, 2) = "Assets:Receivable" > GROUP BY leaf(account) > HAVING not empty(sum(position)) > ORDER BY outstanding DESC > > Cheers, > Dan > > > > On Thursday, January 20, 2022 at 9:51:06 PM UTC-8 Maayaas wrote: > > > > Hi, > > > > I am using the query below to get a list of outstanding payments: > > > > SELECT > > last(date), leaf(account), sum(position) as outstanding > > WHERE > > account ~ "AccountsReceivable" > > GROUP BY leaf(account) > > ORDER BY outstanding DESC > > > > It works as intended but it also lists the zero balance accounts. Is > > there a way to exclude them? > > > > Thanks. > > > > -- > > 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 [email protected] > > <mailto:[email protected]>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/beancount/4c37598c-cd96-4121-9554-86a531711d01n%40googlegroups.com > > > < > https://groups.google.com/d/msgid/beancount/4c37598c-cd96-4121-9554-86a531711d01n%40googlegroups.com?utm_medium=email&utm_source=footer > >. > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/307ae1a8-00df-42c6-a0f7-81163a2cbe4en%40googlegroups.com.
