Fortnox model

Profit and loss by month

Income statement by month (resultaträkning per månad), at account level with the BAS report line alongside so it can be rolled up to the statutory layout in BI.

Grain
one row per financial year x month x account, income statement accounts only (BAS 3000-8989)
Built from
  1. 4
    Raw tables
  2. 5
    Staging
  3. 2
    Core
  4. 1
    Analytics
Reads from Fortnox
accountsfinancial_yearsvoucher_rowsvouchers
Ships as
Weld and dbt SQL, open source on GitHub
core.fortnox.profit_and_loss_by_month
1-- core.fortnox.profit_and_loss_by_month
2-- Income statement by month (resultaträkning per månad), at account level with the BAS
3-- report line alongside so it can be rolled up to the statutory layout in BI.
4--
5-- Grain: one row per financial year x month x account, income statement accounts only
6-- (BAS 3000-8989).
7-- Currency: SEK.
8-- Sign: `amount` is credit positive, the way an income statement reads: revenue is
9-- positive, costs are negative, and SUM(amount) over all lines is the result for the
10-- period. `debit` and `credit` are kept for audit.
11--
12-- Excluded: 8990-8999, the year-end transfer of the result to equity. Including it
13-- would make the closing month of every year sum to zero. Summed over a month or year,
14-- this model gives the result before that transfer, which is what Fortnox's
15-- Resultaträkning report shows.
16
17SELECT
18    financial_year_id,
19    financial_year_start,
20    transaction_month                       AS month,
21    report_line,
22    report_line_sort_order,
23    account_number,
24    account_name,
25    SUM(debit)                              AS debit,
26    SUM(credit)                             AS credit,
27    SUM(amount_credit_positive)             AS amount,
28    COUNT(*)                                AS voucher_rows
29FROM {{core.fortnox.general_ledger}}
30WHERE statement = 'income_statement'
31GROUP BY 1, 2, 3, 4, 5, 6, 7

This model and the 7 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

Excluded: 8990-8999, the year-end transfer of the result to equity. Including it would make the closing month of every year sum to zero. Summed over a month or year, this model gives the result before that transfer, which is what Fortnox's Resultaträkning report shows.

Raw tables it reads

  • raw.fortnox.accounts
  • raw.fortnox.financial_years
  • raw.fortnox.voucher_rows
  • raw.fortnox.vouchers

Put Fortnox in front
of your agents.

Connect Fortnox, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.