Skip to main content

3 posts tagged with "financial reporting"

View all tags

Accrued Expenses in Beancount: A Practical Guide (with copy-paste ledger examples)

· 8 min read
Mike Thrift
Mike Thrift
Marketing Manager

Accrued expenses sound abstract until month-end closes start piling up. They are a cornerstone of proper accrual accounting, ensuring your financial reports reflect economic reality, not just when cash changes hands. Here’s a clear, Beancount-first walkthrough of what they are, why they matter, and exactly how to book, reverse, and report them in your plain-text ledger.

TL;DR ⚡

  • Accrued expenses are costs you’ve incurred this period but haven’t paid yet. They are recorded as a liability until the cash goes out.
  • In Beancount, this is simple: you debit an Expenses: account and credit a Liabilities:Accrued: account. Later, you clear the liability when you pay.
  • To report, you can see what you owe as of a specific date by running a bean-query with CLOSE ON and CLEAR to get a clean balance-sheet snapshot.

2025-08-24-accrued-expenses-in-beancount-a-practical-guide

What is an Accrued Expense?

An accrued expense is a cost that a business has incurred, but has not yet paid. It's recorded when the service is received or the cost is incurred, even if the invoice hasn't arrived or the payment isn't due yet. This practice follows the matching principle of accrual accounting, which dictates that expenses should be recorded in the same period as the revenues they helped generate.

Common examples include:

  • Wages earned by employees at the end of a month but paid in the next.
  • Utilities (electricity, water) you used in December but won't be billed for until January.
  • Interest on a loan that has accumulated over the month but has not yet been withdrawn from your account.

By recording these costs when they happen, you get a much truer picture of your company's financial performance for that period.

How Beancount Thinks About It (in 30 seconds)

Beancount is a plain-text, double-entry accounting system. Everything is a dated directive or transaction in a text file. The system is built on five core account types: Assets, Liabilities, Equity, Income, and Expenses.

Entries are always ordered by date. A key detail is that balance assertions are checked before same-day transactions are processed. This is important to remember when you place checks and reversing entries.

Finally, the bean-query language provides a powerful, SQL-like way to generate reports. With operators like OPEN ON, CLOSE ON, and CLEAR, you can create precise "as-of" views for financial statements.

Your Chart of Accounts (Suggested)

A clean, hierarchical chart of accounts is your best friend. For accrued expenses, the structure is straightforward. You'll need:

  • An expense account: e.g., Expenses:Utilities, Expenses:Payroll:Wages
  • A corresponding liability account: e.g., Liabilities:Accrued:Utilities, Liabilities:Accrued:Payroll
  • Your cash account: e.g., Assets:Bank:Checking

Beancount enforces the five top-level account types. Keeping your account names organized makes querying and reporting much easier down the road.

The Core Pattern (No Plugin, No Magic)

This is the most direct way to handle accruals in Beancount. It involves two steps: accruing the expense at month-end and clearing the liability when you pay.

Step 1: Accrue the Expense at Month-End

On the last day of the period, you record the expense and create the liability.

2025-02-28 * "Accrue February electricity" #accrual
Expenses:Utilities 120.00 USD
Liabilities:Accrued:Utilities

Step 2: Clear the Accrual When You Pay

When the bill comes and you pay it, you don't hit the expense account again. Instead, you debit the liability account to clear it out.

2025-03-05 * "Pay Feb electricity - City Power"
Liabilities:Accrued:Utilities 120.00 USD
Assets:Bank:Checking

This is the cleanest approach for small teams. It correctly places the expense in February and ensures you don't double-count it in March. Notice that in Beancount, leaving one amount blank lets the system balance the transaction for you automatically.

Alternative: Reversing Entry on Day 1

If you prefer the classic "auto-reverse" accounting style, you can post the opposite of your accrual entry on the first day of the next month. Then, you book the actual vendor bill to the expense account as you normally would.

Step 1: Accrue at Month-End (Same as before)

2025-02-28 * "Accrue February electricity" #accrual
Expenses:Utilities 120.00 USD
Liabilities:Accrued:Utilities

Step 2: Reverse on the First Day of the Next Month

2025-03-01 * "Reverse Feb electricity accrual" #reversal
Liabilities:Accrued:Utilities 120.00 USD
Expenses:Utilities

Step 3: Book the Payment as Usual

2025-03-05 * "City Power - February bill"
Expenses:Utilities 120.00 USD
Assets:Bank:Checking

Heads-up on checks: Remember that balance assertions evaluate before same-day transactions. If you want to check your Liabilities:Accrued:Utilities account balance, place the assertion on 2025-02-28 to confirm the accrual or on 2025-03-01 after the reversal transaction to confirm it's zero. Placing it before the reversal on 2025-03-01 will cause a false failure.

Six Common Accruals (Copy-Paste Patterns) 📋

Here are some ready-to-use examples for common business accruals.

1. Rent Not Yet Invoiced

2025-01-31 * "Accrue January rent" #accrual
Expenses:Rent 3000.00 USD
Liabilities:Accrued:Rent

2. Wages Earned but Unpaid

2025-03-31 * "Accrue March wages" #accrual
Expenses:Payroll:Wages 8500.00 USD
Liabilities:Accrued:Payroll

3. Vacation Pay (PTO) Earned

2025-03-31 * "Accrue PTO earned in March" #accrual
Expenses:Payroll:PTO 900.00 USD
Liabilities:Accrued:Payroll

4. Interest Accrued on a Loan

2025-02-29 * "Accrue monthly loan interest" #accrual
Expenses:Interest 210.00 USD
Liabilities:Accrued:Interest

5. Professional Fees (Audit/Legal)

2025-12-31 * "Accrue year-end audit fees" #accrual
Expenses:Professional:Audit 4200.00 USD
Liabilities:Accrued:Professional

6. Utilities Used but Not Billed

2025-04-30 * "Accrue April utilities" #accrual
Expenses:Utilities 95.00 USD
Liabilities:Accrued:Utilities

Reporting: "What do I owe as of a certain date?"

bean-query is your tool for getting answers. Here’s how you can get a proper balance sheet snapshot of your accrued expenses.

Get All Accrued Liability Balances at Period-End

This query gives you the balance of each accrued liability account as of March 31, 2025.

bean-query main.beancount '
SELECT account, UNITS(SUM(position)) AS balance
FROM OPEN ON 2025-01-01 CLOSE ON 2025-04-01 CLEAR
WHERE account ~ "^Liabilities:Accrued"
GROUP BY 1
ORDER BY 1;
'
  • OPEN ON sets starting balances at the period start.
  • CLOSE ON truncates transactions before this date (it's exclusive). That's why we use 2025-04-01 to get data up to and including 2025-03-31.
  • CLEAR zeroes out Income and Expenses, giving you a clean balance sheet view (Assets, Liabilities, Equity).

See a Register of All Accrual Postings

If you want to see the raw transaction history for your accrual accounts:

bean-query main.beancount '
SELECT date, payee, narration, position
WHERE account ~ "^Liabilities:Accrued"
ORDER BY date;
'

Get a Single Total for All Accruals

For a quick summary of the total amount you owe:

bean-query main.beancount '
SELECT UNITS(SUM(position)) AS total_accruals
FROM OPEN ON 2025-01-01 CLOSE ON 2025-04-01 CLEAR
WHERE account ~ "^Liabilities:Accrued";
'

Controls & "Gotchas" Specific to Beancount

  • Balance Assertions Timing: As mentioned, assertions check the balance at the start of the day. 2025-03-01 balance ... runs before any transactions on 2025-03-01. Plan accordingly.
  • Naming and Hierarchy: A tidy tree like Liabilities:Accrued:* is not just for looks. It makes your queries simpler and your reports instantly understandable.
  • Pad with Caution: The pad directive can fix opening balances, but avoid using it to "fix" recurring accruals. Making explicit entries provides a clear audit trail.
  • As-Of Reporting: For balance-sheet snapshots, always prefer OPEN ... CLOSE ... CLEAR in bean-query. This prevents income and expense accounts from polluting your liability totals.

Prepaid vs. Accrued (Quick Contrast)

It's easy to mix these up. They are mirror images:

  • Accrued Expense: Service consumed now, cash paid later. This creates a liability.
  • Prepaid Expense: Cash paid now, service consumed later. This creates an asset.

The accounting logic is the same in Beancount; only the accounts differ (Assets:Prepaid:* vs. Liabilities:Accrued:*).

Drop-in Template (Start of File)

Here are the open directives you'd need for the examples used in this post. Add these to the top of your ledger file once.

; --- Accounts (open once) ---
2025-01-01 open Assets:Bank:Checking
2025-01-01 open Expenses:Utilities
2025-01-01 open Expenses:Payroll:Wages
2025-01-01 open Expenses:Interest
2025-01-01 open Expenses:Professional:Audit
2025-01-01 open Liabilities:Accrued:Utilities
2025-01-01 open Liabilities:Accrued:Payroll
2025-01-01 open Liabilities:Accrued:Interest
2025-01-01 open Liabilities:Accrued:Professional

Final Notes

If you run your books on a cash basis, you won’t post accruals at all—expenses are simply recorded when they are paid. If you run on an accrual basis, using the patterns above is essential for matching costs to the period where you consumed the service.

The examples here provide general educational guidance. Always consult your CPA for industry-specific treatments, especially regarding bonuses, payroll taxes, and capitalization thresholds.

The Green Ledger: Tracking ESG with Beancount

· 6 min read
Mike Thrift
Mike Thrift
Marketing Manager

In today's world, Environmental, Social, and Governance (ESG) metrics are no longer just buzzwords; they're essential indicators of a company's health and future viability. But how do you integrate these crucial sustainability insights with traditional financial accounting? Enter Beancount, an open-source, plain-text double-entry ledger that offers a surprisingly powerful and flexible solution for bridging this gap.

Imagine transforming your fragmented sustainability reporting into a streamlined, automated system that tracks everything from carbon emissions to supplier diversity, all within your existing financial workflow. Beancount makes this possible by treating ESG data as "first-class citizens alongside financial transactions."

2025-06-22-esg-tracking

Modeling ESG Data: The Beancount Way

Beancount's inherent flexibility is its superpower when it comes to ESG. Instead of siloed spreadsheets, you can embed sustainability metrics directly into your financial structure using a few key techniques:

  • Dedicated Accounts and Commodities: Think of your environmental footprint like another currency. You can create accounts like Metrics:Emissions:CO2e to track carbon emissions. These emissions can even be treated as a commodity (e.g., a unit of CO2 equivalent, tCO2e), allowing you to record specific quantities in your transactions. For instance, a flight purchase could credit an Emissions:CO2e account with +0.3 tCO2e alongside the monetary cost.
  • Custom Metadata Tags: Beancount's key-value metadata is perfect for adding context. You can tag a transaction with CO2e: 0.3 t or Scope: 3 to denote its carbon impact or GHG Protocol scope. This links financial outlays directly to their environmental consequences, providing a richer, more complete picture.
  • Structured Tags for Categories: Aligning with standards like the Greenhouse Gas Protocol (GHGP) is crucial. You can use consistent tags or account naming conventions, such as Metrics:Emissions:Scope1, Metrics:Emissions:Scope2, and Metrics:Emissions:Scope3 to easily categorize and report on direct, energy-related, and value chain emissions.

This adaptable approach means that as ESG standards evolve, you can adjust your ledger structure without a complete overhaul.


Beancount vs. Specialized ESG Tools: A Strategic Choice

While dedicated ESG platforms like Persefoni or SAP Green Ledger offer highly automated, purpose-built solutions, Beancount presents a compelling alternative, particularly for those seeking transparency and control.

FeatureBeancount (Plain-Text)Specialized SaaS (e.g., Persefoni, Plan A)Enterprise ERP Integration (e.g., SAP Green Ledger)
Data ModelingUser-defined accounts & metadata; flexible but requires manual structuring.Pre-defined schemas; guided input for activities and automated conversion to emissions.Emissions mapped directly to ERP transactions and master data.
Emission FactorsUser-supplied or integrated via custom scripts; requires manual updates.Built-in, regularly updated emission factor libraries; automatic calculations.Integrated with corporate data and standard factors for audit-grade accuracy.
Data IntegrationOpen architecture via custom Python scripts/APIs; requires development for automated imports.Many pre-built connectors to external data sources (utilities, ERPs, travel systems).Native integration with core business processes and data flows within the ERP.
Reporting & AuditCustom queries and Fava reports; highly customizable but requires user design. Version control (Git) for transparent audit trail.Rich dashboards, pre-built reports for standards (GHG, TCFD, CDP). In-platform audit logs and period locking.Integrated reporting within ERP; designed for "reasonable assurance" auditable data.
Cost & AccessibilityFree and open-source; requires Beancount/scripting knowledge.Commercial SaaS with subscription costs; less technical overhead.Enterprise software with potentially high licensing and implementation costs; requires specific ERP expertise.

Beancount is a DIY powerhouse: It gives you unparalleled flexibility and transparency, making it ideal for individuals or technically savvy small organizations. You own your data completely, avoiding vendor lock-in.

Specialized tools offer turnkey solutions: They excel at automated data collection, built-in emission factor databases, and ready-made compliance reports, often at a higher cost and with less flexibility.

A hybrid approach is also viable: use Beancount for detailed internal tracking and reconciliation, then export summary data to an external platform for high-level stakeholder reporting.


Real-World Applications: ESG in Action with Beancount

Beancount’s versatility makes it suitable for several key ESG use cases:

  • Tracking Scope 3 Emissions: The most challenging emissions to track (from your value chain) can be integrated by linking supplier emissions data to purchase transactions. Beancount provides a clear audit trail for these complex figures, enabling better analysis and pinpointing data sources.
  • Sustainability Audits and Assurance: Like financial data, ESG figures need to be verifiable. Beancount allows you to link each ESG entry to source documents (e.g., utility bills, third-party verification statements), providing a meticulous audit trail for transparency and assurance.
  • EU CSRD/ESRS Compliance Reporting: For companies facing stringent regulations like CSRD, Beancount can serve as a central repository for quantitative disclosures. While it won't automatically format reports into XBRL, it provides the granular, auditable data needed to generate compliance-ready figures.
  • Carbon Footprint Analysis & Management Accounting: Treat carbon as another dimension of management accounting. By allocating emissions to profit centers or product codes, you can calculate metrics like "emissions per dollar of revenue" and identify carbon hotspots, driving more informed sustainability decisions.

Best Practices for Your Beancount ESG Ledger

To maximize the effectiveness of Beancount for ESG, consider these best practices:

  1. Design a Clear Chart of Accounts for ESG: Structure your ESG accounts thoughtfully (e.g., Metrics:Emissions:Scope1:Fuel), just like your financial accounts.
  2. Use Metadata Consistently: Leverage tags (e.g., Scope: 3, FactorSource: EPA2024) for consistent context and easier querying.
  3. Balance Granularity with Manageability: Focus on material metrics to avoid overwhelming your ledger with unnecessary detail.
  4. Automate with Caution: Use Python scripts for data import and validation, but ensure robust error checking and clear documentation of your automation processes.
  5. Leverage Version Control: Use Git to track every change to your ledger, providing a transparent and auditable history of your ESG data.
  6. Connect to Documents and Evidence: Link source files (e.g., PDFs of utility bills) to ledger entries for easy verification during audits.
  7. Utilize Fava for Insights: Configure Fava to display custom ESG charts and reports, making your sustainability data actionable and accessible to non-technical stakeholders.
  8. Stay Updated on Standards: ESG reporting is dynamic; be prepared to adapt your Beancount structure as new regulations and frameworks emerge.

The Future is Green, and Plain-Text

While Beancount currently lacks native ESG intelligence or plug-and-play reporting, its open-source nature presents immense opportunities for enhancement. Community-driven plugins for carbon accounting, standardized ESG ledger templates, and better integration with emission factor APIs could significantly boost its capabilities.

As the corporate world increasingly embraces "green ledgers," Beancount stands ready as a flexible, transparent, and auditable solution. By integrating ESG data with the same rigor as financial data, Beancount empowers organizations to not only meet compliance demands but also drive meaningful sustainability initiatives.

Are you ready to bring your ESG data into the plain-text revolution?

Enhancing Your Beancount Experience with Custom Links and Queries

· 3 min read
Mike Thrift
Mike Thrift
Marketing Manager

Beancount, the double-entry accounting system beloved by developers and finance nerds alike, is powerful in its simplicity. But for those who want more control and faster navigation inside Fava, Beancount’s web interface, custom sidebar links and SQL queries can take your workflow to the next level.

In this guide, we’ll show you how to:

  • Add quick-access links to Fava’s sidebar
  • Use SQL queries for advanced filtering and analysis
  • Customize your workflow for monthly reviews or anomaly detection

Why Customize Fava?

Fava is already a beautiful interface for viewing your Beancount ledger, but as your journal grows, so does the need for better shortcuts and smarter queries.

Pain points this solves:

  • Navigating through time ranges repeatedly
  • Filtering transactions across nested accounts
  • Spotting negative balances or anomalies faster

Let’s start with improving your daily workflow with simple sidebar shortcuts. These links appear in Fava’s left sidebar and can take you directly to filtered views like this month’s transactions or last month’s income.

Add these lines to your Beancount file:

2021-01-01 custom "fava-sidebar-link" "Current Month" "/jump?time=month"
2021-01-01 custom "fava-sidebar-link" "Last Month" "/jump?time=month-1"
2021-01-01 custom "fava-sidebar-link" "Clear All" "/jump?account=&time=&filter="

What They Do:

  • Current Month: Opens the transaction view filtered to the current month.
  • Last Month: Instantly jumps to the previous month—great for end-of-month reviews.
  • Clear All: Resets filters, showing all entries again.

These shortcuts eliminate manual time input and make your Fava experience feel more fluid and personalized.

🔍 Custom SQL Queries

For deeper insight, Fava’s SQL interface is incredibly powerful. Here’s a query that finds all negative balances in accounts that match a pattern—perfect for flagging unusual or problematic transactions.

SELECT account, units(sum(position)), sum(position)
WHERE number(units(position)) < 0
AND account ~ '.*:BCM:.*'
AND date >= DATE(2021,12,9)
AND date < DATE(2022,1,9)

Breakdown:

  • account ~ '.*:BCM:.*': Filters accounts containing :BCM: in their name.
  • number(units(position)) < 0: Flags negative balances (e.g. overspent budgets).
  • Date filters narrow the result to a specific 1-month window.

Use cases:

  • Spot errors like duplicate expenses or incorrect postings
  • Audit a specific vendor or category
  • Quickly extract actionable insights for budgeting

While Fava doesn’t allow direct links to custom queries, you can create a monthly review habit by:

  • Using the “Current Month” link to start your review
  • Opening your saved queries tab in another pane
  • Reviewing both simultaneously—filter first, then dig deep

This combo helps you catch anomalies before they spiral and ensure your ledger stays clean.

Final Thoughts

Beancount is minimal by design, but small enhancements like these bring huge gains in efficiency. Whether you’re reviewing your budget, debugging strange balances, or simply saving clicks, custom links and SQL queries give you more power and less friction.

Bonus: If you're using Fava’s custom reports, you can even build full dashboards tailored to your personal finance rituals.

Ready to take control?

Start small: add the “Current Month” link. Then build your own queries. Your future self will thank you.

Want more tips like this? Subscribe to our newsletter or explore more Beancount recipes at Beancount.io.