Profit & Loss

Profit & Loss facts on GL Accounts, defining values per date, value type, and GL account.

Facts

Definitions

ColumnDescription
dateDate in YYYY-MM-DD format, reference to Dates.
gl_account_idWhich GL Account (links to GL Accounts).
value_type_idType of value measured (links to Value Types, e.g., actuals, budget).
amountFact registered in a currency unit.

Sample & Implementation

A list of PnL' GL Accounts
dategl_account_idvalue_type_idamount
2025-01-011010215000000
2025-02-011010215194000
2025-03-011010215448294.23
2025-04-011010215702878.21
2025-05-011010215957747.59
2025-06-011010216212898.14
2025-07-011010216468325.76
2025-08-011010216718990.28
2025-09-011010216969918.37
2025-10-011010217221106.42
CREATE TABLE IF NOT EXISTS pnl (
    date DATE NOT NULL,
    gl_account_id INTEGER NOT NULL,
    value_type_id INTEGER NOT NULL,
    amount INTEGER NOT NULL,
    FOREIGN KEY (date) REFERENCES dates(date),
    FOREIGN KEY (gl_account_id) REFERENCES gl_accounts(id),
    FOREIGN KEY (value_type_id) REFERENCES value_types(id),
    PRIMARY KEY (date, gl_account_id, value_type_id)
)

Data Format

Field

Type

The primary key is formed by constrainst on dates, GL accounts, and value types:
PRIMARY KEY (date, gl_account_id, value_type_id)

Dependencies

On this page

Star us on GitHub

If you enjoy this content and find it useful, give us a star on GitHub to show your support and stay updated with our latest improvements.