Skip to content

bean-sql

bean-sql is a language to query beancount data.

bean-sql snippets

Get the quarter of a date

Use the quarter(date) selector in the SELECT . For example:

SELECT quarter(date) as quarter, sum(position) AS value
WHERE 
    account ~ '^Expenses:' OR
    account ~ '^Income:'
GROUP BY quarter

It will return the quarter in the format YYYY-QX.

References