GitHub
Cash flow

The statement of cash flows, and the cfsection: / cfgroup: tags

The Cash Flow tab is a statement of cash flows, laid out the way QuickBooks and an accountant’s spreadsheet lay one out (the indirect method). It starts from net income and adjusts it by how much each non-cash balance-sheet account changed. The adjustments are sorted into three sections:

Operating activities
    Net income
    assets:receivable                       $-5,000.00
    liabilities:deferred-revenue             $2,200.00
    …
    Net cash from operating activities
Investing activities
    assets:equipment                        $-3,000.00
    Net cash from investing activities
Financing activities
    liabilities:note                         $8,000.00
    Net cash from financing activities
Net change in cash
Beginning cash
    assets:bank:checking …
Ending cash
    assets:bank:checking …

Every line shows the account’s effect on cash. An asset that grew used cash, so it reads negative: invoices you haven’t been paid for yet, equipment you bought. A liability that grew supplied cash, so it reads positive: bills you haven’t paid yet, a customer paying in advance, a loan.

The Cash Flow tab for January to June 2026: From and To boxed, Interval circled, and the Total column of the Operating section boxed

How it reconciles

Every transaction balances, so net income plus every line adds up exactly to the change in your cash accounts, in every column and every currency. Net change in cash is computed that way, and Ending cash minus Beginning cash must equal it. If a column ever disagrees, a note at the bottom of the statement says so. The only cause is a posting date that puts one side of a transaction in a different period from the other, and the Total column still agrees.

Three rules keep the statement reconciled:

Unbalanced virtual postings ((account) in parentheses) are left out for the same reason: they don’t balance with the rest of their transaction.

Controls

ControlWhat it setsDefault
FromFirst day of the report, inclusiveThe 1st of the month 11 months before today
ToLast day of the report, inclusiveToday
IntervalTotal, Monthly, Quarterly or YearlyMonthly
Account depthHow deep an untagged account’s line rolls up3

The Account depth slider stops at the deepest account the statement lists, so every setting changes something. An [cashflow] --depth line in hledger.conf sets the starting depth once; switching tabs and back leaves the depth you picked alone.

With an interval, there is one column per period and then Total. For the flows (net income, every line, the section totals, net change) the Total is the sum of the periods. For Beginning cash it is the first period’s beginning balance, and for Ending cash the last period’s ending balance, because a sum of month-end balances is not a meaningful figure. With Interval set to Total there is one column, headed Amount.

A saved link from before Cash Flow had From and To (?tab=cf&end=2026-06-30&count=6&interval=monthly) still opens the same columns, and the address bar switches to the From/To form.

Which section an account lands in

Revenue and expense accounts are never lines of their own, because they make up net income. These rules place every other account, and the first match wins:

  1. A cfsection: tag on the account, or on its nearest declared parent.
  2. Type Cash (type: C): the account is cash, shown under Beginning and Ending cash.
  3. A valuation: adjustment tag (depreciation, unrealized, mark, adjustment): Operating. Accumulated depreciation is the usual case. The depreciation expense is already in net income, and this line adds it back because no cash moved.
  4. An asset that is non-current: Investing. Non-current means bsterm: noncurrent on it or a parent, or, with no bsterm:, an asset that has held a commodity other than your base currency (shares, a fund), which is the balance sheet’s Investments rule.
  5. A liability tagged bsterm: noncurrent: Financing.
  6. Any other asset or liability: Operating. That covers receivables, prepaid expenses, payables, credit cards, payroll payable and deferred revenue.
  7. Equity: Financing.
  8. An account with no type at all: Operating.

Types come from type: declarations, or from hledger’s name inference when an account declares none. See Accounts.

cfsection: moves an account

ValueSection
operatingOperating activities
investingInvesting activities
financingFinancing activities
cashCounts as cash: shown in the cash balances, not as an adjustment
account liabilities:long-term                   ; type: L, bsterm: noncurrent, cfsection: operating
account assets:fixed:accum-depreciation         ; type: A, valuation: depreciation, cfsection: investing
account assets:treasury-bills                   ; type: A, cfsection: cash

cash lets an account count as cash or a cash equivalent without changing its hledger type:, which other hledger tools read.

There is no value that leaves an account out. Leaving out a balance-sheet account would stop the statement adding up to your cash, with no warning.

A misspelt value is ignored, the account falls back to the rules above, and Problems names it. A cfsection: or cfgroup: on a revenue or expense account is also ignored and reported, because those accounts count only through net income.

cfgroup: names the line

Without a tag, each account is its own line, rolled up to the Account depth, which matches QuickBooks’ one-line-per-account layout. At depth 2, assets:prepaid:insurance and assets:prepaid:rent become one Prepaid line; at depth 3 they are two. A line is labelled by its account’s name: tag or last segment, never its full path. Hover the label for the path.

A line that stands for more than one account has an arrow that opens it to the accounts behind it, laid out as on the P&L: each level once, headings only where two or more accounts share a parent.

cfgroup: collapses accounts into one named line, even from different parts of the tree. This gives the “∆ in AR” style of a hand-built spreadsheet:

account assets:receivable           ; type: A, cfgroup: ∆ in AR
account liabilities:payable         ; type: L, cfgroup: ∆ in AP
account liabilities:cards           ; type: L, cfgroup: ∆ in AP

The tag inherits to sub-accounts. It works on cash accounts too: tag several bank accounts with the same cfgroup: and they roll up into one line under Beginning and Ending cash.

The cash balances

Beginning cash and Ending cash list every cash account with a balance or a movement in the range, by line, and start open so the per-account detail is on screen. Two banks with a checking and a savings account each read as two bank headings with Checking and Savings under each. A name: tag on the bank account (account assets:bank:fcb ; name: First Community Bank) names the heading. Opening or closing a line under one opens or closes it under the other, so the two lists always line up.

Keyboard

j/k move through the visible rows. Enter opens a line, or shows an account’s postings in the journal for the report’s date range.

The chart

Above the statement, one stacked bar per period for each section: Operating, Investing, Financing, and Exchange rates when there is any. Cash in is above zero and cash out below it, and the Net change in cash is the line across the bars. Every bar segment is a section total in the statement below. Each section’s bars use the colour of its heading in the statement, so the chart and the table use the same colour for Operating, Investing and Financing whatever their sizes. Exchange rates is grey.

The chart draws one currency. Anything else is named under it (“Charted in $ only; EUR not shown”), and the statement still shows it. With Interval set to Total there is one column, so the chart asks for a wider range instead of drawing a single bar.

Export

Export .xlsx writes the statement as on screen, at the screen’s Account depth, with every line opened and each label’s full account path as a cell note. The workbook has a column per period and Total (or one Amount column). Amounts in your main currency are real numbers, and anything in another currency goes in an Other commodities column. The file is cash-flow-<from>-to-<to>-<interval>.xlsx.

API

GET /api/reports/cashflow
      ?from=YYYY-MM-DD        (no default; switches to the range form)
      &to=YYYY-MM-DD          (default: today; both ends inclusive)
      &interval=total|monthly|quarterly|yearly
                              (default: monthly; daily and weekly also work)
      &depth=N                (default: 2)

Each line carries label and account (null for a cfgroup: line), and its rows are outline rows {kind, label, level, account, …} with kind one of heading, account or other. A heading’s figures are its subtree’s total, and the app doesn’t print them. maxDepth is the deepest account behind any line.

Without from, the older end, count and interval parameters name the same columns as before and are converted to the range they cover.