Xero profit and loss (by month) in a live spreadsheet

Add the Profit and loss (by month) table to a sheet as a data source named profit_and_loss_by_month and its 7 columns become names your formulas, pivot tables and charts use. Sheets reads it from your Xero organisation each time the sheet opens or refreshes.

Formulas on this table

=data.profit_and_loss_by_month.sum(months_ago)
Total months ago. Adds up the Months ago column over every row of Profit and loss (by month).
=data.profit_and_loss_by_month.sum(months_ago, section, A2)
Months ago per section. With a section in A2, the total for that one. Fill it down next to a list of them.
=list.profit_and_loss_by_month(section)
Every section, once. Spills the distinct section values down the column: the row labels for the formula above.
=data.profit_and_loss_by_month.sum(months_ago, month, ">=2026-01-01")
Since a date. Only rows whose Month is on or after 1 January 2026. Criteria such as ">=", "<" and "<>" work as in any spreadsheet.
=data.profit_and_loss_by_month.count(section, section, "<>")
Rows with a section. Counts the rows whose Section is not empty.
=data.profit_and_loss_by_month.avg(amount)
Average amount. avg, min, max, count, countd (distinct) and first work the same way as sum.

Reports that use it

=data.profit_and_loss_by_month.sum(profit_impact, months_ago, 0)
Net profit this month. From the profit and loss by month: months_ago 0 is the current month, 1 the month before.
=data.profit_and_loss_by_month.sum(profit_impact)
Net profit, last 12 months. The rolling twelve-month result in one cell.

Columns

ColumnIn formulasType
SectionsectionText
AccountaccountText
Account IDaccount_idText
MonthmonthDate
Months agomonths_agoWhole number
AmountamountNumber
Profit impactprofit_impactNumber

Other reports tables

Your profit and loss (by month), live

Invoices, bills, bank transactions and your monthly profit and loss become tables that formulas, pivots and charts read directly, in your base currency.