GROUP by financial year

76 views
Skip to first unread message

Martin Michlmayr

unread,
Mar 16, 2020, 4:19:35 AM3/16/20
to bean...@googlegroups.com
I can use:

SELECT YEAR, SUM(position) WHERE account ~ '^Income' GROUP BY YEAR ORDER BY YEAR

to see all income per year.

Unfortunately, the financial year is not the calendar year. Is there
a way to use bean-query to do a GROUP BY on a fiancial year or do I
have to write a script?

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

Martin Blais

unread,
Mar 16, 2020, 8:08:05 AM3/16/20
to Beancount
I don't think there's a concert of financial year that's != calendar year.

--
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/20200316075211.GW25911%40jirafa.cyrius.com.

Martin Michlmayr

unread,
Mar 16, 2020, 8:17:51 AM3/16/20
to bean...@googlegroups.com
s/concert/concept/?

* Martin Blais <bl...@furius.ca> [2020-03-16 08:07]:
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhNDs0kbdkH-%3DJi%3Df7Lqmd9Ecw3hKbEu_7ab60%2BtL%2BWXuQ%40mail.gmail.com.

Martin Blais

unread,
Mar 16, 2020, 8:19:08 AM3/16/20
to Beancount
Yep
Cell phone finger fart

Oon-Ee Ng

unread,
Mar 17, 2020, 2:23:48 AM3/17/20
to bean...@googlegroups.com
Fairly common for some organizations to have financial years starting on (say) 1st August or something similar. Sometimes to sync up with regulatory requirements, sometimes so that bonuses/promotions hit a particular period of the year, sometimes due to expected peak dates for a particular industry.

Martin Michlmayr

unread,
Mar 17, 2020, 2:26:27 AM3/17/20
to bean...@googlegroups.com
I wasn't sure how to interpret Martin's reply. At first, I thought he
was saying that he's not aware of circumstances where the FY !=
calendar year. But then I realized that he he was just stating that
beancount doesn't have a concept of FY.

As you say (and I'm sure as Martin is full aware), the FY often
differs. The tax year is also different in some countries, e.g. in
the UK it starts on April 6.

What would the best way be to implement FY in beancount?

* Oon-Ee Ng <ngoone...@gmail.com> [2020-03-17 14:23]:
> > https://groups.google.com/d/msgid/beancount/CAK21%2BhNDs0kbdkH-%3DJi%3Df7Lqmd9Ecw3hKbEu_7ab60%2BtL%2BWXuQ%40mail.gmail.com
> > <https://groups.google.com/d/msgid/beancount/CAK21%2BhNDs0kbdkH-%3DJi%3Df7Lqmd9Ecw3hKbEu_7ab60%2BtL%2BWXuQ%40mail.gmail.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 beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAGQ70euz0fJfv3rT%2BBZWCr5G89bjLsEG5MfNp2KgPUdSzc10HQ%40mail.gmail.com.

kuba jamro

unread,
Mar 17, 2020, 9:47:36 AM3/17/20
to Beancount
+1 for this as a feature request built into beancount.

I would be willing to help in the development of this feature too.


One of the ways I thought this could be done is in fava and actually it looks like it has already have been done to a basic level.


I've given it a quick test and it seems to only work in the time filter box of fava and not in the BQL queries but I could I stand to be corrected.

Jakub.

On Tuesday, 17 March 2020 06:26:27 UTC, Martin Michlmayr wrote:
I wasn't sure how to interpret Martin's reply.  At first, I thought he
was saying that he's not aware of circumstances where the FY !=
calendar year.  But then I realized that he he was just stating that
beancount doesn't have a concept of FY.

As you say (and I'm sure as Martin is full aware), the FY often
differs.  The tax year is also different in some countries, e.g. in
the UK it starts on April 6.

What would the best way be to implement FY in beancount?

* Oon-Ee Ng <ngoon...@gmail.com> [2020-03-17 14:23]:
> Fairly common for some organizations to have financial years starting on
> (say) 1st August or something similar. Sometimes to sync up with regulatory
> requirements, sometimes so that bonuses/promotions hit a particular period
> of the year, sometimes due to expected peak dates for a particular industry.
>
> On Mon, Mar 16, 2020 at 8:08 PM Martin Blais <bl...@furius.ca> wrote:
>
> > I don't think there's a concert of financial year that's != calendar year.
> >
> > On Mon, Mar 16, 2020, 04:19 Martin Michlmayr <t...@cyrius.com> wrote:
> >
> >> I can use:
> >>
> >> SELECT YEAR, SUM(position) WHERE account ~ '^Income' GROUP BY YEAR ORDER
> >> BY YEAR
> >>
> >> to see all income per year.
> >>
> >> Unfortunately, the financial year is not the calendar year.  Is there
> >> a way to use bean-query to do a GROUP BY on a fiancial year or do I
> >> have to write a script?
> >>
> >> --
> >> Martin Michlmayr
> >> https://www.cyrius.com/
> >>
> >> --
> >> 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 bean...@googlegroups.com.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/beancount/20200316075211.GW25911%40jirafa.cyrius.com
> >> .
> >>
> > --
> > 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
> To unsubscribe from this group and stop receiving emails from it, send an email to bean...@googlegroups.com.

kuba jamro

unread,
Mar 17, 2020, 9:52:52 AM3/17/20
to Beancount
FYI the format quite simple

# this matches a financial year like FY2018 for the financial year ending 2018
FY_RE = re.compile(r"^fy(\d{4})$")

# this matches a quarter in a financial year like FY2018-Q2
FY_QUARTER_RE = re.compile(r"^fy(\d{4})-q(\d)$")
Reply all
Reply to author
Forward
0 new messages