e-conomic Monthly P&L
Monthly P&L by classifier section, from e-conomic's period totals.
What it answers
- What was the result each month?
- How did revenue and costs develop this year?
The view is named after the company, such as "Acme ApS Monthly P&L", and reads the company's e-conomic data.
How to add it
Gatlas adds it for a company when the company connects e-conomic, and it fills in after the first sync. For a company that connected earlier, ask an AI assistant on a Read/write MCP connection:
Add the e-conomic Monthly P&L view for Acme ApS.
The assistant creates it with the template id economic/monthly-pnl, after checking that the company's data has every column the template reads.
Columns
connection_label: The e-conomic agreement the row comes from.accounting_year: e-conomic accounting year.period_start: First day of the month.period_end: Last day of the month.section: Classifier section label for the accounts in the row.pnl: Net amount in base currency, revenue positive, costs negative.n_accounts: Number of accounts with postings in the row.data_as_of: Most recent sync of the rows summed.
What the AI assistant is told
The company's monthly P&L from e-conomic period totals, one row per agreement, month and section.
pnl is in base currency with the sign flipped so revenue is positive and costs are negative; net result for a month is SUM(pnl).
section comes from the shared account classifier and is a guess for a chart it has not seen; the account-level detail and the chart's own headings are in the Monthly Trial Balance view.
The SQL
__SCHEMA__ stands for the company's schema. To adapt the view, copy the SQL, put the schema in its place and change what your company needs.
SELECT
pt."_gatlas_connection_label" AS connection_label,
pt."accountingYear" AS accounting_year,
pt."periodFromDate"::date AS period_start,
pt."periodToDate"::date AS period_end,
public.gatlas_classify_account(a."accountNumber", a."name", a."debitCredit") AS section,
ROUND(SUM(-pt."totalInBaseCurrency")::numeric, 0)::bigint AS pnl,
COUNT(DISTINCT a."accountNumber") AS n_accounts,
MAX(pt."_gatlas_synced_at") AS data_as_of
FROM __SCHEMA__.economic_accounting_year_period_totals pt
JOIN __SCHEMA__.economic_accounts a
ON a."accountNumber" = pt."accountNumber"
AND COALESCE(a."_gatlas_connection_label", '') = COALESCE(pt."_gatlas_connection_label", '')
WHERE a."accountType" = 'profitAndLoss'
AND pt."totalInBaseCurrency" <> 0
GROUP BY 1, 2, 3, 4, 5
ORDER BY 1, 3, 5