Docs menu

Variance Table

The Ninth Forge Variance Table (nf_NinthForge.VarianceTable) turns rows of actuals, plans and prior years into an IBCS profit and loss table. You get groups that open and close, variance bars and percentages for each row, running subtotals such as EBIT, and a title that states the result.

The table has:

  • groups that open and close, such as Revenue, Cost of sales and Operating expenses, with their lines inside;
  • for each row: AC, PL, a ΔPL bar, a ΔPL% pill, PY, a ΔPY bar, a ΔPY% pill and a 12-month Trend sparkline (only the columns you have data for);
  • running subtotals, such as Gross profit and EBIT;
  • a message title that states the result: “EBIT is 120 (22.4%) above plan, led by Revenue (+550)”.

A Variance Table of a profit and loss: each account with actual, plan and prior year, the variances as values, percentages and bars coloured good or bad, and a trend line.

Free and Pro

Actual against one comparison (plan or prior year) is free, with groups, subtotals and the Δ bars, as long as Variance % style is Plain text. It starts at Pill, so change it for the free table. Both comparisons together, the trend, and Δ% as pills or bubbles are Charts Pro. Without a key, Pro tables work fully and show a small watermark.

Set it up

  1. Make a view with one row per amount. It needs:
    • a Group column, such as the account category;
    • an optional Line column, such as the account;
    • an Actual (AC) column;
    • a Plan (PL) column, a Prior year (PY) column, or both;
    • optional: a Date (for the trend) column, for the sparkline.
  2. Put the control on the view (model-driven apps) or bind it to the table (canvas apps), and map the columns.
  3. Set Cost groups to the groups where more is worse, separated by commas, such as Cost of sales, Operating expenses. Their variances show green when they’re under plan, and subtotals subtract them.
  4. Set Subtotals, each with the group it follows, separated by semicolons: Gross profit after Cost of sales; EBIT after Operating expenses.
  5. Optional: set Group order, such as Revenue, Cost of sales, Operating expenses. Other groups follow in the order they appear.
  6. Optional: set Message title compares with to choose what the message title compares with. If that comparison isn’t mapped, the title uses the one that is.

Rows are added up by group and line, so the view can hold one row per account per month. The trend shows 12 months of actuals, ending at the latest month in the data. The control reads up to 50,000 rows.

Using it

  • Open and close groups with the + and − buttons, or with Expand all and Collapse all. Groups start sets whether groups start Open or Closed.
  • Sort by clicking a column header: largest first, then smallest first, then back to the P&L order. Rows sort inside their group, so Revenue stays above Cost of sales. The Trend column doesn’t sort.
  • Select a row by clicking its name, or Tab to it and press Enter. selectedRow, selectedGroup and selectedRecordIds (JSON) update, and OnSelect runs. Subtotals have no records of their own, so selectedRecordIds is empty for them.

The Δ bars in a column share one scale, so opening a group never rescales them, and each label sits beside its bar. Variance % style sets how the Δ% values look: Pill, Bubble or Plain text, the same looks as the chart callouts. Screen readers read every value, with “better” or “worse”.

Long tables stay fast: past 300 rows on screen, the table draws only the rows in view.

For every setting, see Properties.

In code

import { VarianceTable, tableFromRows } from '@ninthforge/charts';

<VarianceTable
  rows={[
    { key: 'rev', label: 'Revenue', children: [{ key: 'svc', label: 'Services', ac: 1830, pl: 1720, py: 1600 }] },
    { key: 'cos', label: 'Cost of sales', invert: true, children: [{ key: 'frt', label: 'Freight', ac: 690, pl: 610, py: 600 }] },
    { key: 'gp', label: 'Gross profit', subtotal: true }
  ]}
/>;

To build the same tree from flat records, use tableFromRows(records, { costGroups: ['Cost of sales'], subtotals: [{ label: 'Gross profit', after: 'Cost of sales' }] }).

Last updated