Exclude empty amounts with GROUP BY

9 views
Skip to first unread message

Martin Michlmayr

unread,
Mar 16, 2020, 4:19:25 AM3/16/20
to bean...@googlegroups.com
I want to see a list of outstanding invoices. Given the example
below, I can use:

beancount> SELECT ENTRY_META('invoice'), SUM(position) WHERE account ~ '^Assets:Receivable' GROUP BY ENTRY_META('invoice')
ent sum_posit
--- ---------
A01
B01 30.00 USD

Is there a way to exclude positions that are 0, i.e. that have been
paid?

Example:

2020-01-01 open Assets:Bank
2020-01-01 open Assets:Receivable
2020-01-01 open Income:Sponsorship

2020-03-01 * "Sponsorship from A"
invoice: "A01"
Assets:Receivable 100.00 USD
Income:Sponsorship -100.00 USD

2020-03-01 * "Sponsorship from B"
invoice: "B01"
Assets:Receivable 30.00 USD
Income:Sponsorship -30.00 USD

2020-03-10 * "Payment from A"
invoice: "A01"
Assets:Bank 100.00 USD
Assets:Receivable -100.00 USD

--
Martin Michlmayr
https://www.cyrius.com/

Martin Blais

unread,
Mar 16, 2020, 8:09:56 AM3/16/20
to Beancount
This would need a filtering expression of the aggregate, it's not implemented. SQL defines a syntax thought.

--
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/20200316074928.GV25911%40jirafa.cyrius.com.
Reply all
Reply to author
Forward
0 new messages