On Fri, Sep 21, 2018 at 1:34 AM Oon-Ee Ng <[email protected]> wrote:

> I'm not sure if this is a bug or intended behaviour, so seeking advise
> here first.
>
> SELECT QUARTER(date) as quarter, last(balance)
> FROM date > 2017-12-31
> WHERE account ~ 'Assets:Banking|Assets:Cash'
> GROUP BY quarter
> ORDER BY quarter, DESC
>
> What it returns is the balances assuming that it starts at a balance of 0
> on 2018-01-01 (which makes sense I guess) but what I'm looking for with the
> FROM date > 2017-12-31 is to only return results from that period of time.
> Something similar to what fava does when you place '2018' into the 'Time'
> box.
>
> So for example if my banking accounts and cash had 5000 on the first of
> January and 2000 now, the query above would return -3000. I'd like it to
> return 2000 (which it does if I remove the FROM, but also returns all my 13
> years of accounting history...)
>

Opening and closing periods is described here (apologies for the long
document):
http://furius.ca/beancount/doc/intro

Simply filtering postings indeed ignores the (filtered) past.
Best is to use OPEN.

Replace
  FROM date > <date>
with
  FROM OPEN ON <date>

This substitutes the past transactions with summarizing ones to bring the
accounts to the same balance.

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOne2ywNodRbFL8%2BP6S1LDgRnys3-%3DUgRc6soJ-Dv51%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to