Is there an automated way to close the books for a given period?

146 views
Skip to first unread message

Dan Schultz

unread,
Mar 16, 2022, 12:07:39 PM3/16/22
to Beancount
I'm looking to close the books for a pay period (zero-out the income / expense accounts into a revenue summary account so I can distribute equity among my partners).

I saw some mention that there is the concept of "clearing", which would automatically generate transactions to close the books for a given pay period but I'm not seeing it documented anywhere.

Is there a ledger entry I can use to signal the end of a period which would trigger that kind of action; or maybe a command / plugin folks use to generates the needed transactions?

Best,
 - Dan

Scott

unread,
Mar 16, 2022, 5:35:03 PM3/16/22
to Beancount
I'm relatively new to beancount, so I have a limited picture at this point, but here's my understanding:

beancount is designed to allow closing of the books at arbitrary points in time. The benefit of this is that you can run reports for whatever time period you'd like and have the effect of that being the 'accounting period'. The downside to this is that since there's no formal/explicit closing of the books, there are not necessarily fixed journal entries corresponding to that action. This means that as an auditing tool, you need to be a bit careful with beancount, because (for better and worse) there's nothing to guarantee that you won't/can't modify the journal after the end of the reporting period.

I imagine, that you'd thus want to put your ledger under version control, and check it in at the end of the fiscal year. The reports for the fiscal year would show revenue and you'd then draw from assets to pay shareholders accordingly. You could, but there's no need to, explicitly zero out income and expenses, but if you chose to do that it locks you into fixed schedule reporting because a report that spans the end of the fiscal year will have the odd artifacts of the zeroing transactions.

Clearly my understanding is limited ;) But I'm also using beancount for a small business, so hopefully others will weigh in if I'm too far off the mark.

Cheers,
 -Scott

Martin Blais

unread,
Mar 16, 2022, 10:54:47 PM3/16/22
to Beancount
+1 to all that


--
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/5a38c51b-facd-4ed5-97e2-b63f2efb4e18n%40googlegroups.com.

Dan Schultz

unread,
Mar 17, 2022, 12:03:12 AM3/17/22
to Beancount
Thank you both -- this makes sense (and I'm finally getting through the query language documentation which, as I believe / hope I'm correctly understanding, is where that closing-from-whatever-date would occur!)

As a followup: how would I handle account for changes to equity with this approach?  To be clear I'm talking about net profit that hasn't be distributed / the asset still exists in the company.

Specifically, we report allocations for each partner to tax authorities based on an annual reporting period; this is where our targeted allocation formulas kick in, etc.

I'm having trouble meshing the "close any time" concept with the ability to track that equity allocation -- particularly in a situation where partners might join or leave over time, or might have different targeted allocations of a given annual profit.

I hope the problem / question makes sense.

Note: one idea I had is that maybe I need to just create parallel register purely to track equity.  It would ONLY track contributions, distributions, balanced against cash -- and end-of-year allocations balanced against {some well named account}.  The separation and slight duplication makes this an imperfect concept... but I'd love to know if it's my best bet!

Or... is there some way to give beancount a "hint" about how I want equity to get distributed when books close for a given period (e.g. a set of transactions against the `Equity:Earnings:Current` that only gets recognized when running CLEAR  queries?)

Martin Blais

unread,
Mar 17, 2022, 12:10:01 AM3/17/22
to Beancount
The idea of "close at any time" just means that the calculation for net income and transfer to a summarized set of equity accounts happens at the time of reporting and is automated. Nothing prevents you from adding equity accounts and creating manual entries at the end of your fiscal year.


Dan Schultz

unread,
Mar 17, 2022, 12:47:58 AM3/17/22
to Beancount
> The idea of "close at any time" just means that the calculation for net income and transfer to a summarized set of equity accounts happens at the time of reporting and is automated.

I had interpreted this line (see below) from Scott's email as the reason why the manual entries are ideally avoided, but appreciate I may not understand (I apologize / thanks for bearing with me):

> You could, but there's no need to, explicitly zero out income and expenses, but if you chose to do that it locks you into fixed schedule reporting because a report that spans the end of the fiscal year will have the odd artifacts of the zeroing transactions.

To confirm I'm understanding, if I run:

```
SELECT account, sum(position) FROM OPEN ON 2017-01-01 CLOSE ON 2018-01-01 WHERE account ~ "Income|Expenses" GROUP BY 1 ORDER BY 1;
```


I get that beautiful report which tells me my income and expenses for 2017

If I were to add manual entries at the end of the fiscal year, wouldn't I end up dirtying that report?  I'd need to balance the equity changes against the net profit / Equity:Earnings:Current, (which would require me manually zeroing out the income / expense accounts) right?

Just a sanity check: when we're talking about querying we aren't talking about something I do *in* the register / can write followup transactions against, right?  I am under the impression that the book closing queries don't actually translate to closed positions outside of the query's output.

Best,
- Dan

Dan Schultz

unread,
Mar 17, 2022, 1:18:59 AM3/17/22
to Beancount
I finally get it -- I *CAN* add manual entries balanced against the Equity:Earnings:Current account to register whatever equity transfers I need; I just need to explicitly open it first!

This is because whenever I run a report with a CLEAR it will generate the closing transactions (for the sake of the report) into that special `Equity:Earnings:Current` (no problem at all that the account already existed before running the report!).

Thank you all for helping me to the point of clarity :D

Best,
 - Dan

Martin Blais

unread,
Mar 17, 2022, 10:02:38 AM3/17/22
to Beancount
You got it
Or you can open other accounts in equity if desired.


Reply all
Reply to author
Forward
0 new messages