A SuiteQL P&L that ties to NetSuite
A guarded NetSuite SuiteQL Income Statement query on TransactionAccountingLine, verified on live demo data and footed to zero on a OneWorld group.
Frontier · December 2, 2026
An applied guide for the controller or FP&A analyst rebuilding a NetSuite Income Statement in SuiteQL — or auditing an AI-generated query.
The short answer. To build a NetSuite Income Statement in SuiteQL that ties to the standard report, query Transaction → TransactionLine → TransactionAccountingLine (joined on both transaction and transactionline), join Account, AccountingPeriod, Subsidiary, and Currency, and enforce four guards: tal.posting = 'T', tal.accountingbook = 1, ap.isposting = 'T' AND ap.isquarter = 'F' AND ap.isyear = 'F' on t.postingperiod, and explicit credit/debit sign math grouped by c.symbol. Skip any one of those four and the query still runs cleanly while silently returning the wrong P&L.
Most SuiteQL snippets circulating online — and most first-draft queries an AI assistant writes — pull from TransactionLine alone, filter on t.trandate, omit tal.accountingbook = 1, or sum TransactionAccountingLine amounts across subsidiaries in different base currencies. Below is the exact guarded query Frontier uses for NetSuite P&L reads, what each guard catches on our live NetSuite demo ledger, and a constructed OneWorld reconciliation that foots to zero.
The SuiteQL P&L query
This is the base-currency P&L query by posting month, account class, detail account, and subsidiary currency. Add a period window (as shown in the commented ap.startdate / ap.enddate lines) to isolate one month or fiscal year, and add tl.subsidiary to SELECT and GROUP BY when you need a subsidiary-level break for OneWorld consolidation.
SELECT
TO_CHAR(ap.startdate, 'YYYY-MM') AS month,
CASE a.accttype
WHEN 'Income' THEN 'income'
WHEN 'COGS' THEN 'cogs'
WHEN 'Expense' THEN 'expense'
WHEN 'OthIncome' THEN 'other_income'
WHEN 'OthExpense' THEN 'other_expense'
END AS class,
a.fullname AS account,
ROUND(SUM(CASE WHEN a.accttype IN ('Income', 'OthIncome')
THEN NVL(tal.credit, 0) - NVL(tal.debit, 0)
ELSE NVL(tal.debit, 0) - NVL(tal.credit, 0) END), 2) AS amount,
c.symbol AS currency
FROM transaction t
JOIN transactionline tl ON t.id = tl.transaction
JOIN transactionaccountingline tal
ON tl.transaction = tal.transaction
AND tl.id = tal.transactionline
JOIN account a ON tal.account = a.id
JOIN accountingperiod ap ON t.postingperiod = ap.id
JOIN subsidiary s ON tl.subsidiary = s.id
JOIN currency c ON s.currency = c.id
WHERE tal.posting = 'T'
AND tal.accountingbook = 1
AND a.issummary = 'F'
AND a.accttype IN ('Income', 'COGS', 'Expense', 'OthIncome', 'OthExpense')
AND ap.isposting = 'T'
AND ap.isquarter = 'F'
AND ap.isyear = 'F'
-- Optional single-month window:
-- AND ap.startdate >= TO_DATE('2026-10-01', 'YYYY-MM-DD')
-- AND ap.enddate <= TO_DATE('2026-10-31', 'YYYY-MM-DD')
GROUP BY TO_CHAR(ap.startdate, 'YYYY-MM'), a.accttype, a.fullname, c.symbol
ORDER BY a.fullname, TO_CHAR(ap.startdate, 'YYYY-MM')
Two structural choices hold this query together before the four guards even run:
- Three-table join path (
t→tl→tal). Oracle documents that joiningTransaction > Transaction Line > Transaction Accounting Lineprevents the data duplication that occurs if you joinTransaction > Transaction Accounting Linedirectly (Joining Transaction Line and Transaction Accounting Line). Joining on bothtl.transaction = tal.transactionandtl.id = tal.transactionlinematches each accounting line to its exact transaction line and bringstl.subsidiaryonto the row, becauseTransactionAccountingLinehas no subsidiary column. - Detail P&L accounts only (
a.issummary = 'F'). NetSuite's standard Income Statement selects data by account type across five sections — Income, Cost of Sales, Expense, Other Income, and Other Expenses (Income Statement Report). Oracle defines summary accounts as non-posting parent accounts created for reporting rollups (Creating Accounts); filteringa.issummary = 'F'keeps the query strictly on detail posting accounts.
The four guards — and why skipping any one breaks the tie-out
tal.posting = 'T'— exclude non-posting lines. Oracle defines non-posting transactions as records that do not impact the general ledger, including purchase orders, sales orders, and return authorizations (Working with Transactions). Those records still appear inTransactionAccountingLinewithposting = 'F'. Withouttal.posting = 'T', open sales orders and unapproved journals flow straight into revenue and expenses.tal.accountingbook = 1— isolate one accounting book. Oracle warns that when Multi-Book Accounting is enabled, "each transaction accounting line stores data for each accounting book in your NetSuite account" and advises filtering on the accounting book field so data from only one book is included (Joining Transaction Line and Transaction Accounting Line). On a full secondary book, book-generic transactions are "created and shared across all accounting books" (Book-Generic and Book-Specific Records), so an unconstrained query counts every posting once per book. On an adjustment-only book, day-to-day postings sit in the base book and period-end adjustments sit in the adjustment-only book (Adjustment-Only Books Overview); omitting the book filter drops secondary-book journals into a primary-book P&L. Saved searches default to the primary book (Reports, KPIs, and Saved Searches in Multi-Book Accounting); SuiteQL has no such default. Filtertal.accountingbook = 1directly on the accounting line (use your target book ID for a secondary book), because many read-only API roles cannot query theaccountingbooktable itself.ap.isposting = 'T' AND ap.isquarter = 'F' AND ap.isyear = 'F'ont.postingperiod— select by posting period, not transaction date. Oracle states that filtering a report by date range selects records by transaction date, whereas filtering by period selects by posting period (How can I filter report results by periods or dates). Whenever Allow Transaction Date Outside of Posting Period is set to Warn or Allow (General Accounting Preferences), filtering ont.trandatepulls transactions posted to an adjacent month. JoiningAccountingPeriodont.postingperiodfixes the cutoff, and keepingap.isposting = 'T' AND ap.isquarter = 'F' AND ap.isyear = 'F'excludes the parent quarter and fiscal-year rollup rows that NetSuite builds around monthly base periods (Setting Up Single Accounting Periods). Always compare SuiteQL flags to quoted'T'and'F', not booleans.- Explicit credit/debit signs and
c.symbolcurrency separation. OnTransactionAccountingLine,debitandcreditare mutually exclusive (one is null), soNVL(tal.credit, 0) - NVL(tal.debit, 0)forIncomeandOthIncomeandNVL(tal.debit, 0) - NVL(tal.credit, 0)forCOGS,Expense, andOthExpenseprints every P&L section positive as NetSuite's Income Statement does, without depending ontal.amount's credit-negative sign convention. Just as important, Oracle specifies thatTransactionAccountingLine"stores monetary values in the base currency of the subsidiary assigned to the transaction" (Joining Transaction Line and Transaction Accounting Line). Grouping byc.symbol(andtl.subsidiaryon OneWorld) ensures EUR and USD rows are never silently summed 1:1. To roll child subsidiaries into a consolidated P&L, include the elimination subsidiary (Subsidiary Context for Reports) and translate each child subsidiary's base total using the period's Average consolidated exchange rate (Consolidated Exchange Rates on Reports; Consolidated Exchange Rate Types) — either in SQL viaConsolidatedExchangeRateorBUILTIN.CONSOLIDATE(BUILTIN.CONSOLIDATE), or explicitly in your reporting layer.
Measured on our NetSuite demo ledger
Read-only SuiteQL runs against our NetSuite demo ledger (logged verbatim in the packet, zero customer data, zero truncation across every query) show how quickly those traps appear even on a small account:
- Guarded October 2026 P&L: Running the exact guarded query above for October 2026 returned
57detail account rows covering596posting lines across two visible USD subsidiaries (2and3): Income1,024,496.56, COGS682,750.81, Expense242,109.26, and Other Expense1,729.50, netting to97,906.99USD. - What leaks without
tal.posting = 'T': In that same October 2026 period,166non-posting P&L lines sit insideTransactionAccountingLine(tal.posting = 'F'):160SalesOrdlines carrying114,658.89in income,3ItemShiplines carrying150.90in COGS, and3Journallines carrying115.95in expense. Across all periods on the demo account,3,054non-posting P&L lines (2,985of themSalesOrdlines carrying2,034,936.04net credit minus debit, plusOpprtnty,Estimate,RtnAuth,Journal,ItemShip,ExpRept, andInvCountlines) sit alongside13,272posting lines. - Rollup rows in
AccountingPeriod: The demo account'sAccountingPeriodtable holds238rows —168base posting periods (isposting = 'T',isquarter = 'F',isyear = 'F'),56quarter summary rows (isquarter = 'T'), and14fiscal-year summary rows (isyear = 'T'). Any period-table date-range query that skips the base-period flags pulls70non-posting rollup rows beside the monthly periods. tal.amountsign direction and scope limits: Across all 18(accountingbook, posting, type)groups in the all-period diagnostic,SUM(NVL(tal.amount, 0))returned the exact opposite sign ofSUM(NVL(tal.credit, 0) - NVL(tal.debit, 0))(for example,CustInvcreturned-1,969,561.44ontal.amountversus1,969,561.44on credit minus debit). These demo figures measure SuiteQL rows visible to the reader role rather than a native NetSuite UI printout, and the demo account holds only accounting book1and USD subsidiaries with P&L postings — so Multi-Book leakage and EUR→USD currency mixing do not fire there. The constructed OneWorld group below isolates all five breaks at once.
Worked tie-out: Harbor Inc. (Consolidated), October 2026
Every Harbor figure below is constructed. This is the same OneWorld October 2026 group used in Why a saved search won't match NetSuite's P&L, so every anchor stays intact: Harbor Inc. (US parent, USD), Harbor GmbH (German subsidiary, EUR), Harbor Elimination (USD), primary book US GAAP (accountingbook = 1), an IFRS adjustment-only secondary book (accountingbook = 2), and an October Average consolidated exchange rate of 1.1000 EUR→USD set directly for the open period (Editing Consolidated Exchange Rates).
Running the guarded SuiteQL query above with tl.subsidiary and c.symbol returns each subsidiary cleanly in its own base currency — no silent cross-currency addition — and multiplying Harbor GmbH's EUR base balances by October's 1.1000 Average consolidated rate ties straight to NetSuite's Consolidated Income Statement:
| Guarded SuiteQL output by subsidiary | Base currency | Revenue (base) | Expenses (base) | Net income (base) | Oct avg rate | Revenue (USD) | Expenses (USD) | Net income (USD) |
|---|---|---|---|---|---|---|---|---|
| Harbor Inc. | USD | 131,000 | 70,000 | 61,000 | 1.0000 | 131,000 | 70,000 | 61,000 |
| Harbor GmbH | EUR | 50,000 | 34,000 | 16,000 | 1.1000 | 55,000 | 37,400 | 17,600 |
| Harbor Elimination | USD | (11,000) | (11,000) | 0 | 1.0000 | (11,000) | (11,000) | 0 |
| Consolidated Income Statement (Oct 2026, primary book) | USD | 175,000 | 96,400 | 78,600 |
Constructed figures. Harbor Inc. revenue comprises USD 120,000 external customer invoices plus USD 11,000 intercompany management fee to Harbor GmbH; Harbor GmbH expenses comprise EUR 24,000 external vendor bills plus EUR 10,000 intercompany fee bill; Harbor Elimination reverses both sides (USD 11,000 revenue and USD 11,000 expense).
Now contrast that with a naive SuiteQL query against TransactionAccountingLine: filtered by t.trandate in October 2026, restricted to the two operating subsidiaries (Harbor Inc. and Harbor GmbH), missing tal.posting = 'T' and tal.accountingbook = 1, and summing raw base-currency tal balances without grouping by c.symbol (adding Harbor GmbH's EUR 50,000 revenue and EUR 34,000 expenses straight onto Harbor Inc.'s USD totals at 1:1):
| Bridge from naive SuiteQL pull to NetSuite P&L (USD) | Revenue | Expenses | Net income |
|---|---|---|---|
| Naive SuiteQL pull (unguarded) | 196,000 | 117,000 | 79,000 |
1 · Posting period: drop Oct-dated bill posted to Nov (t.postingperiod, not t.trandate) |
0 | (8,000) | 8,000 |
2 · Posting flag: drop non-posting Sales Order line (tal.posting = 'T') |
(15,000) | 0 | (15,000) |
3 · Accounting book: drop IFRS adjustment-only depreciation (tal.accountingbook = 1) |
0 | (5,000) | 5,000 |
| 4 · Currency translation: translate Harbor GmbH EUR at 1.1000 instead of summing 1:1 | 5,000 | 3,400 | 1,600 |
| 5 · Elimination subsidiary: include Harbor Elimination intercompany reversal | (11,000) | (11,000) | 0 |
| Reconciled SuiteQL P&L | 175,000 | 96,400 | 78,600 |
| NetSuite Income Statement, Harbor Inc. (Consolidated), Oct 2026, primary book | 175,000 | 96,400 | 78,600 |
| Difference | 0 | 0 | 0 |
USD. Constructed figures; generated and re-footed by the packet script committed beside this page.
Look at the bottom line of the naive SuiteQL pull: USD 79,000 versus NetSuite's USD 78,600 — a net income gap of only USD 400 (0.5%). A gap that small is easy to shrug off as FX rounding. Underneath it sit USD 21,000 of overstated revenue and USD 20,600 of overstated expenses because five independent SQL errors partially cancel.
Auditing an AI-generated SuiteQL P&L
Whether you write the query yourself or review one an AI assistant generated, read the WHERE and GROUP BY clauses before you read the totals:
- Confirm the join uses
Transaction→TransactionLine→TransactionAccountingLineon bothtransactionandtransactionline. - Confirm
tal.posting = 'T',tal.accountingbook = 1(or your target book), anda.issummary = 'F'. - Confirm the date filter runs through
t.postingperiodjoined toAccountingPeriodwithap.isposting = 'T' AND ap.isquarter = 'F' AND ap.isyear = 'F', nott.trandate. - Confirm signs come from
NVL(tal.credit, 0) - NVL(tal.debit, 0)(income) andNVL(tal.debit, 0) - NVL(tal.credit, 0)(COGS/expense), and that rows are grouped byc.symbol(andtl.subsidiary) unless consolidated translation and elimination subsidiaries are explicitly handled.
When you ask Frontier a question about your NetSuite ledger, it writes SuiteQL against your account and returns the query and underlying rows beside the answer. Its ledger query guidance calls for posting lines, the primary book (book 1), and posting-period filters, and its P&L ledger read uses the exact four-guard TransactionAccountingLine pattern above while keeping subsidiary currencies separate. Inspect the attached query and rows before relying on any figure at close.
Frontier reads your NetSuite through one integration role that you create and can revoke at any time: web-services only, view-level record permissions. Every answer carries the query and the rows behind it, so your team can check any figure against the ledger. Results are stored and processed in Frontier's secured infrastructure, and each customer's workspace is isolated at the database layer. In conversations and analysis your data is never sent in bulk to an AI model provider: by default the model sees only a small preview of a result — its shape, column names and a handful of rows — while the broader analysis runs as code inside Frontier's own secure compute environment, so your data is never sent anywhere it does not need to be. Per-column redaction of sensitive fields such as customer names, addresses and emails is applied inside NetSuite, so redacted values never leave NetSuite. Teams in regulated industries can use Frontier with confidence, knowing their sensitive data stays in NetSuite and their compliance surface does not grow. Our customers' operational data is a liability to us, not an asset: we have no interest in it beyond answering your questions. Frontier is built to deliver the analysis you need while exposing our infrastructure to as little of your data as possible — data minimisation by default. We are committed to the highest standards of privacy and security and to continuously strengthening our posture.
One next step: run the four-point audit above on your current SuiteQL P&L — or see Asking the ledger for how Frontier attaches the query and rows behind every figure, and Why a saved search won't match NetSuite's P&L for the matching saved-search reconciliation on the same Harbor group.
Sources and limits
Every Harbor figure in this guide is constructed and re-footed by the packet script committed beside this page; none comes from a customer account. The demo-account counts and sums come from logged, read-only SuiteQL runs on our own NetSuite demo ledger visible to the reader role; they are not compared against a native NetSuite UI report printout, and that demo account contains only primary book 1 and USD subsidiaries with P&L postings. NetSuite behaviour claims cite Oracle's documentation live at publication: Joining Transaction Line and Transaction Accounting Line, Income Statement Report, Creating Accounts, Working with Transactions, Book-Generic and Book-Specific Records, Adjustment-Only Books Overview, Reports, KPIs, and Saved Searches in Multi-Book Accounting, How can I filter report results by periods or dates, General Accounting Preferences, Setting Up Single Accounting Periods, Subsidiary Context for Reports, Consolidated Exchange Rates on Reports, Consolidated Exchange Rate Types, BUILTIN.CONSOLIDATE, and Editing Consolidated Exchange Rates.
Questions this raises
- Which tables do you join to build a NetSuite Income Statement in SuiteQL?
- Join Transaction to TransactionLine, then TransactionLine to TransactionAccountingLine on both transaction and transactionline, and join Account, AccountingPeriod, Subsidiary, and Currency. Oracle recommends Transaction > Transaction Line > Transaction Accounting Line to avoid record-join duplication and to bring subsidiary context onto each accounting line.
- Why does a SuiteQL Income Statement overstate revenue or expenses compared to NetSuite?
- Four missing guards account for most breaks: omitting tal.posting = 'T' pulls non-posting sales orders and drafts, omitting tal.accountingbook = 1 mixes multiple accounting books, filtering on t.trandate instead of posting periods shifts cutoff lines, and summing tal balances without grouping by subsidiary currency silently adds different currencies 1:1.
- Should a SuiteQL P&L sum TransactionAccountingLine.amount or debit and credit?
- Sum NVL(tal.credit, 0) - NVL(tal.debit, 0) for Income and OthIncome accounts and NVL(tal.debit, 0) - NVL(tal.credit, 0) for COGS, Expense, and OthExpense accounts. Debit and credit are mutually exclusive (so NVL prevents null arithmetic), and computing the sign explicitly avoids relying on tal.amount's credit-negative sign convention.
- How does SuiteQL handle multi-currency subsidiaries on a consolidated P&L?
- TransactionAccountingLine stores amounts in each subsidiary's base currency. Group by subsidiary and Currency.symbol first so EUR and USD postings never sum 1:1, include the elimination subsidiary, and translate each child subsidiary's base total using the period's Average consolidated exchange rate (via ConsolidatedExchangeRate, BUILTIN.CONSOLIDATE, or a downstream model).