---
title: "e-conomic Monthly P&L"
description: "Monthly P&L by section, such as revenue, cost of goods and personnel, from e-conomic's period totals."
url: https://www.gatlas.ai/docs/datasets/catalog/economic/monthly-pnl
markdown_url: https://www.gatlas.ai/docs/datasets/catalog/economic/monthly-pnl.md
---

# e-conomic Monthly P&L

Monthly P&L by section, such as revenue, cost of goods and personnel, from e-conomic's period totals.

Template id: economic/monthly-pnl. Added for a company when it connects e-conomic. The dataset is named "{Company} Monthly P&L".

## Questions it answers
- What was the result each month?
- How did revenue and costs develop this year?

## 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.

## AI context

__ENTITY__'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 dataset.

## SQL

__SCHEMA__ stands for the company's schema (schema_name in list_companies), and __ENTITY__ for its name.

```sql
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
```

Link: https://www.gatlas.ai/docs/datasets/catalog/economic/monthly-pnl.md
