GitHub
Income statement

The income statement, and the issection: / isgroup: tags

The P&L is a stack of boxes, such as Revenue and Expenses. Each line in a box is a group of accounts rather than a raw account, and Ledgeline values it into a single currency so every line is one number. Net income is below the boxes.

By default the statement covers one date range and sets it beside the range of the same length just before it, with a % change for every line. Pick Monthly, Quarterly or Yearly instead and you get one column per period plus a Total, the way QuickBooks lays out a P&L.

If you tag your accounts, the statement expands into the full GAAP multi-step form, with Cost of revenue, Gross profit, EBITDA, Operating income and Income before taxes. If you tag nothing, none of those lines appear, so a personal journal shows only Revenue, Expenses and net income.

The design notes and the reasoning behind each decision are in plans/13-income-statement-redesign.md and, for the intervals and Total column, plans/24-report-intervals-and-totals.md.

The controls

ControlWhat it setsDefault
FromFirst day of the statement, inclusiveJanuary 1 of the current year
ToLast day of the statement, inclusiveDecember 31 of the current year
IntervalTotal, Monthly, Quarterly or YearlyTotal
DepthHow many account levels a line lists; deeper accounts fold into their ancestorAll levels
BudgetAdds an italic Budget column after TotalOff

Total gives one column for the whole range, compared with the range before it. The other three split the range into periods. The next two sections cover each mode.

The P&L in Total mode: From, To and the Interval control set to Total, with the Prior and % change columns beside Amount in the Revenue box

Why groups instead of accounts

The reason is the same as on the balance sheet. A chart of accounts is organised for bookkeeping, and a statement is organised for reading. You want to know what you spent on housing, not the split between expenses:housing:rent and expenses:housing:insurance. Each line is a group, collapsed by default; expand one to see the accounts behind it, at full depth.

Groups also make the report easier to scan. The old report printed a rolled-up income row, then every account under it, then a Total Revenues footer that repeated the same figure. Groups replace the ancestor rows, and no number is printed twice.

Depth trims the drill-down, not the groups. At depth 2, expenses:travel:airfare and expenses:travel:hotel fold into one Travel row, as hledger is --depth 2 would print them. Group, section and net income totals never change with depth. The slider stops at the deepest account the statement lists. An [incomestatement] --depth line in hledger.conf sets the starting depth. After that, the slider keeps your setting until the config changes.

How accounts inside a line are laid out

The accounts under a group are laid out like a bookkeeper’s statement rather than a list of paths. The same rules apply on the balance sheet and in the cash flow statement:

Travel
    Airfare                     1,200
    Ground Transport              340
    Lodging
        Hotels                    900
        Short-term Rentals        410
    Total Travel                2,850

The Budget column

Tick Budget to show your budget goals beside the actuals. An italic Budget column appears right after Total (after Amount in Total mode, before Prior), covering the same From–To range. There is one Budget column, not one per period.

Each goal appears on the row it describes:

A goal whose accounts are split across groups can’t go on any one row, because that row’s actual wouldn’t match it. It is counted only in the section total, and a note under the section says so: “Budget for People Costs spans groups: shown in section total only.”

Goals follow the same rules as the Budget page, including a parent goal collecting its children’s spending. Goals on accounts that aren’t on the P&L are ignored.

The two tags

issection: picks the box. It takes one of seven codes and nothing else:

CodeBox
revenueRevenue
cogsCost of revenue
opexOperating expenses (or just “Expenses”, see below)
depreciationDepreciation & amortization
interestInterest
taxIncome taxes
otherOther income & expense

isgroup: names the line inside that box. It is free text, in any language:

account cogs                  ; type: X, issection: cogs
account cogs:hosting          ; type: X, isgroup: Cloud hosting
account cogs:payments         ; type: X, isgroup: Payment processing
account expenses:salaries     ; type: X, issection: opex
account expenses:depreciation  ; type: X, issection: depreciation
account expenses:interest     ; type: X, issection: interest
account expenses:taxes:income  ; type: X, issection: tax
account income:grants         ; type: R, issection: other

Both tags inherit to sub-accounts, as type: does, so tagging cogs covers everything beneath it unless a child overrides it. Accounts that share an isgroup: value share a line, even if they are in unrelated parts of the tree.

Balance-sheet accounts never appear here, whatever they are tagged. An account whose type is asset, liability or equity (declared or inferred from its name) is left off the income statement even with an issection: or isgroup: tag, and Problems warns about each tag. If the account’s name says expense or revenue and only its type: disagrees, the type is probably a typo, and Problems says that instead. The usual case is a contra-asset such as accumulated depreciation. Its credits mirror the depreciation expense, so showing it in the same box would cancel that expense out of net income. Tag the expense account. The balance sheet shows the contra-asset.

An issection: value that isn’t one of the seven codes is ignored, and the account falls to its default section. Ledgeline still reports it. Problems names the account, the value you wrote and the seven valid codes, because a mistyped classification tag puts an account in the wrong box.

Two pitfalls from hledger’s tag syntax

A tag value ends at the next comma. This affects isgroup: most, because group names are often phrases:

account cogs:ops  ; type: X, isgroup: Servers, bandwidth     ; ✗ group is "Servers"
account cogs:ops  ; type: X, isgroup: Servers and bandwidth  ; ✓ the whole phrase

The tag name is the last word before the colon, so don’t put a space inside it. ; income section: cogs declares a tag called section, not issection.

What happens with no tags at all

Everything of declared type R lands in Revenue, everything of type X lands in Expenses. The statement then has two boxes and a net income figure.

Ledgeline does not guess cogs, tax, interest or depreciation sections. Any rule that could find them in an untagged journal would have to match English account names, and when name matching gets it wrong, a section reads zero. A journal rooted at cogs: with type: X lands in Expenses and reads correctly. One issection: cogs tag moves it to its own box.

How a line is chosen when there is no isgroup:

Ledgeline groups untagged accounts by dropping the prefix that every account in the box shares and taking the next segment:

Accounts in the boxShared prefixLines
income:salary, income:dividendsincomeSalary, Dividends
expenses:food:groceries, expenses:housing:rentexpensesFood, Housing
cogs:materials, expenses:rent(none)Cogs, Expenses

The shared prefix carries no information. If every expense is under expenses:, repeating it on every line adds nothing, and the next segment is the category you chose. When a box holds accounts from different roots, nothing is shared, so the roots become the lines.

The balance sheet uses the same rule. On a chart where every account is under one root, it gives the balance sheet’s “second path segment” grouping, so the two statements group alike.

As on the balance sheet, grouping never matches account names. It uses only position in the tree. The same small alias table may change how a label reads, but it never moves an account to a different line.

The subtotal ladder

Boxes appear in this order, and a box with nothing in it is omitted entirely. Each subtotal appears only when the sections that give it meaning exist:

Revenue
Cost of revenue                          if any cogs
    Gross profit                         if any cogs
Operating expenses
    EBITDA                               if any depreciation
Depreciation & amortization              if any depreciation
    Operating income                     if the statement is multi-step
Other income & expense                   if any other
Interest                                 if any interest
    Income before taxes                  if any tax
Income taxes                             if any tax
                                Net income

EBITDA is above D&A and Operating income is below it. That is the order a standard statement uses, and it makes every subtotal a running total of everything printed above it. Ledgeline hides EBITDA when there is no D&A box, because it would be the same number as Operating income, and this redesign avoids printing a number twice.

The opex box is titled “Expenses” on a simple statement and “Operating expenses” once the statement goes multi-step. It is the same box either way. Only the label changes, so no account moves to another box when you add your first cogs: tag.

Signs

Every box prints as a positive amount, and the ladder does the subtracting. The exception is Other income & expense, which can hold both income and expense. A grant and a lawsuit settlement can share it, so it shows a net contribution to income and can print negative, in parentheses as on a standard statement.

Total mode: Amount, Prior and % change

With Interval set to Total, every box has three figure columns:

The net income panel under the boxes shows the same three figures, in the same order: this range, the prior range, and the % change.

Interval mode: one column per period

Set Interval to Monthly, Quarterly or Yearly and the statement splits From to To into periods, one column each, followed by a Total column. The first and last periods are cut at From and To, so a range that starts mid-month gives a partial first month. Column headers read like Jan 2026. Hover over one to see its exact dates.

The P&L at a monthly interval for January to June 2026: one column per month and the Total column boxed on the right

Interval mode has no Prior column and no % change. Net income becomes a row under the boxes with a figure for every period and for the Total.

The Total is the sum of the period columns, which is what QuickBooks does. Under market valuation each period is valued at its own end date, so the Total can differ from what Total mode prints for the same range, where everything is valued once at To. That difference is expected. On fixtures/sample.journal, Yearly from 2025-01-01 to 2026-12-31 puts Travel at a Total of $1,405.50, while Total mode for the same two years shows $1,446.36. Cost is the same on every date, so ?value=cost on the API makes the two agree.

Ledgeline decides which lines and groups exist from all the periods together. A line that only had activity in March still appears in every column, with zeros in the months it was quiet.

The Money in and Money out diagrams do not split by period. In both modes they cover the whole From to To range.

Valuation

By default, Ledgeline values lines at market in your base currency, so foreign spending and dividends show as one amount instead of a column of currencies. Prices come only from the journal’s P directives, matching hledger is -V.

Ledgeline does not drop a commodity that has no usable P directive. It stays on its line as a secondary figure, and a warning banner above the report names it.

?value=cost and ?value=none are available on the API for the cost basis and for raw, unvalued commodities.

Why net income here isn’t Retained earnings there

The balance sheet computes its Retained earnings line at cost, and this statement values net income at market. On fixtures/sample.journal that is $42,998.91 against $41,916.34. Both are right. The balance sheet’s Valuation adjustment line holds the difference, so assets = liabilities + equity still balances. Ask for ?value=cost and the two figures agree.

The money-flow diagrams

The statement has two Sankey diagrams. Money in is directly above the Revenue box, and Money out is directly above the first cost box that prints. Each one breaks down the side of the statement below it. It is not a second statement.

Money in puts the revenue lines on the left and the accounts the money went to on the right. It shows, for example, that a salary arrived partly as cash in the bank and partly as tax withheld from your pay. Money out swaps the columns. The accounts that funded the spending are on the left and the cost lines are on the right, so you can see which card or account paid for each category.

How a posting is attributed

A statement line is one side of a transaction. The other side is where the money came from or went to. With two postings, that is unambiguous. With more, Ledgeline allocates each statement posting across the postings on the opposite side of the ledger in its own transaction, in proportion to their size. Here is a paycheck:

2026-01-27 * Acme Corp | January salary
    income:salary             $-5,660.00
    expenses:taxes:federal     $1,150.00
    expenses:taxes:state         $310.00
    assets:bank:checking       $4,200.00

This transaction draws Salary to Taxes: Federal at $1,150.00, to Taxes: State at $310.00 and to Bank: Checking at $4,200.00 in Money in, and Salary to Taxes at $1,460.00 in Money out. Gross pay funded the withheld tax, not the cash account, and both diagrams show that.

Ledgeline allocates the statement side rather than the account side, for two reasons. First, each statement posting splits exactly, using integer mantissa arithmetic with the last share taking the remainder. Second, market valuation causes no errors. A transaction balances at cost, not at market, so a valued transaction’s debits and credits may differ, but splitting a known statement amount by proportion doesn’t depend on them balancing.

Other income & expense is in neither diagram. It is the one box the statement lets print negative, because a grant and a lawsuit settlement can share it, so it has no single direction.

When the diagram leaves something out

Ledgeline doesn’t draw links whose net over the window is zero or negative. A category refunded more than it was charged has no width, and a Sankey can’t draw a negative one. The same applies to a statement posting with no counterparty to attribute it to.

When anything is left out, a line under the diagram reads Showing $X of $Y. $X is what the ribbons carry, and $Y is the statement figure they break down. On an ordinary journal the two agree and the line doesn’t appear. Ledgeline never hides the line when they differ, because it is the only place the missing amount shows.

Reading the diagrams

Colour identifies the account, and an account keeps its colour in both diagrams. For example, assets:bank:checking is the same blue wherever it appears. The default theme has fourteen colours, assigned to the biggest accounts first by their combined total across both diagrams. Accounts after the last colour fold into one grey (other) bar, with their links merged. Statement lines never fold and never take a colour, because folding them would hide the spending categories the diagram is meant to show. The panel grows taller instead. Every bar has its own label and figure, and a legend under each diagram names every account, so you never have to rely on colour alone.

Labels never overlap. When bars are too close for their labels, the labels move apart, in bar order, and each label that moved gets a thin line back to its bar. If a column still can’t fit, its smallest bars lose the figure line first and keep the name. The figure is still in the legend. If even names alone don’t fit, the diagram grows taller.

Hover over a bar to see its name, figure and share of its side’s total, or over a ribbon to see where it runs, its figure and its share of the bar it leaves. The box appears at once. Each bar is also a tab stop. Focus one with Tab to see the same box, and press Esc to close it.

Both panels are collapsible, and each remembers its own state across reloads. A collapsed panel also skips its data. The diagrams come from a separate endpoint that makes a second pass over every posting in the window, so with both panels collapsed, Ledgeline fetches nothing. Expanding a panel fetches its data immediately.

A collapsed panel prints its graph total beside the title. An open panel doesn’t, because the bars carry the detail and the box directly below shows the total, so a header figure would repeat it. Where the ribbons and the statement disagree, the open panel says so with Showing $X of $Y.

Export

The Export .xlsx button writes what the screen shows: filled section headers, bold group rows, indented accounts, ruled subtotals, then net income. Every line is valued into one commodity, so the amount cells hold real numbers with a number format rather than text, so you can calculate with them. The export writes groups expanded, whatever is collapsed on screen, laid out as on screen at the screen’s Depth, with each label’s full account path as a cell note. With Budget ticked, an italic Budget column follows Total (or Amount), and the title line adds “with budget”.

The columns depend on the Interval:

IntervalColumns
TotalAccount, Amount, the prior window (headed with its dates), % change, Other commodities, and Other commodities for the prior window
Monthly, Quarterly, YearlyAccount, one column per period, Total (in the base commodity), and Other commodities for the Total

In Total mode the export leaves the % change cell empty where the screen shows —, so the column never shows a 0.0% that wasn’t measured.

The title line names the range and the interval, for example 2026-01-01 to 2026-06-30, monthly, and so does the file name: income-statement-2026-01-01-to-2026-06-30-monthly.xlsx. Two exports of the same range at different intervals can’t overwrite each other.

The two diagrams are not in the workbook. A picture has no numbers to calculate with, and the numbers behind it are already in the boxes it breaks down.

API

GET /api/reports/incomestatement/grouped
      ?from=YYYY-MM-DD        (default: Jan 1 of the current year)
      &to=YYYY-MM-DD          (default: today; both ends inclusive)
      &value=market|cost|none (default: market)
      &valueIn=$              (default: the journal's base commodity)
      &compare=previous|none  (default: previous)
      &interval=total|monthly|quarterly|yearly
                              (default: total; daily and weekly also work)
      &depth=N                (optional; omit for every level, 0 for totals only)
      &budget=1               (optional; adds the budget fields)

Each group’s rows are outline rows: {kind, label, level, account, depth, amounts}, where kind is heading, account, other or (with a budget) total, level is the indent within the group, and account is the full path. A heading’s amounts is its subtree’s total; the app doesn’t print it. maxDepth is the deepest account the statement lists.

With budget=1, every row, group, section and subtotal gains budget (a figure, or null where no goal sits), each section gains budgetUnplaced: [{account, label}] for goals split across groups, and the report gains netIncomeBudget. Without it, none of these keys appear.

interval=total returns the same bytes it always did. Any other interval returns interval mode:

Interval mode refuses some requests with a 400:

valueIn is checked against each bucket’s end date, so it has to price something in at least one of the windows the report values.

The older GET /api/reports/incomestatement is unchanged. It returns the flat, unvalued, hledger is-shaped report, and the hledger parity golden test uses it.

GET /api/reports/incomestatement/flows
      ?from=YYYY-MM-DD        (default: Jan 1 of the current year)
      &to=YYYY-MM-DD          (default: today; both ends inclusive)
      &valueIn=$              (default: the journal's base commodity, else the
                               single commodity the window is written in)

This endpoint takes no value= and no compare=. A link’s width is one number, so widths are always market-valued, and neither diagram has a comparison column. The response carries both graphs, each with its nodes, its links, the total they carry and the sectionTotal they decompose. base is null when the journal has several commodities and nothing prices them against each other, and both graphs are then empty.