Open Presentation

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Metric Delta

    How a metric's change is computed: against the previous row ('compare': "previous", the same aggregate without the last kept row), against a baseline ('compare': { filter }, the same aggregate over the rows that meet this filter instead of the metric's own), against a fixed number ('compare': { value }), or read from a column that already holds it ('field'). Exactly one of 'compare' and 'field'. 'previous' compares row sets, not periods: with several rows per period, filter to one series first or have the host write the change in a column and use 'field'.

    Metadata

    Definition
    #/$defs/MetricDelta
    Form
    2 alternative forms (oneOf)
    Source
    spec/schemas/opf.schema.json

    Field index

    FieldTypeReq.Description
    compareconst | object | object—What the value is compared with.
    compare · Named choices (see schema for other values and constraints)
    "previous"
    fieldstring—A column that holds the change. The change is the metric's aggregate over the same rows of this column. An unknown name is a 'dataset-field-unknown' error.
    asenum—With 'compare': the change as a difference (value minus base) or as a ratio ((value minus base) over the absolute base; 0.12 is 12%). With 'field': what the column holds, which only picks the default format.
    as · Allowed values
    "difference""percent"
    formatref:NumberFormat—How the change is drawn, usually with sign sections ('+0.0;-0.0;0', '+0%;-0%;0%'). Absent: the value column's format with sign sections built from it ('+#,##0.##;-#,##0.##;0' without one), and '+0%;-0%;0%' for a percent.

    compare

    typeconst | object | objectrequirednodefault—

    What the value is compared with.

    compare · Named choices (see schema for other values and constraints)
    "previous"
    compare (oneOf 2).filter[].op · Allowed values
    "=""!=""<""<="">"">=""in"
    compare.json
    {
      "compare": "previous"
    }

    field

    typestringrequirednodefault—

    A column that holds the change. The change is the metric's aggregate over the same rows of this column. An unknown name is a 'dataset-field-unknown' error.

    as

    typeenumrequirednodefaultdifference

    With 'compare': the change as a difference (value minus base) or as a ratio ((value minus base) over the absolute base; 0.12 is 12%). With 'field': what the column holds, which only picks the default format.

    as · Allowed values
    "difference""percent"
    as.json
    {
      "as": "difference"
    }

    format

    typeref:NumberFormatrequirednodefault—

    How the change is drawn, usually with sign sections ('+0.0;-0.0;0', '+0%;-0%;0%'). Absent: the value column's format with sign sections built from it ('+#,##0.##;-#,##0.##;0' without one), and '+0%;-0%;0%' for a percent.

    oneOf 1 · object

    Exact constraints for oneOf 1
    oneOf 1 schema
    {
      "required": [
        "compare"
      ]
    }

    oneOf 2 · object

    Exact constraints for oneOf 2
    oneOf 2 schema
    {
      "required": [
        "field"
      ]
    }
    Complete definition constraints
    Schema constraints
    {
      "type": "object",
      "additionalProperties": false,
      "description": "How a metric's change is computed: against the previous row ('compare': \"previous\", the same aggregate without the last kept row), against a baseline ('compare': { filter }, the same aggregate over the rows that meet this filter instead of the metric's own), against a fixed number ('compare': { value }), or read from a column that already holds it ('field'). Exactly one of 'compare' and 'field'. 'previous' compares row sets, not periods: with several rows per period, filter to one series first or have the host write the change in a column and use 'field'.",
      "oneOf": [
        {
          "required": [
            "compare"
          ]
        },
        {
          "required": [
            "field"
          ]
        }
      ],
      "properties": {
        "compare": {
          "description": "What the value is compared with.",
          "oneOf": [
            {
              "const": "previous"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "filter"
              ],
              "properties": {
                "filter": {
                  "$ref": "#/$defs/DataFilter",
                  "description": "The rows the baseline is computed over. It replaces the metric's own filter instead of adding to it, so it names everything it means."
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "value"
              ],
              "properties": {
                "value": {
                  "$ref": "#/$defs/FiniteNumber",
                  "description": "A fixed number to compare with: a plan, a budget, last year's figure typed in."
                }
              }
            }
          ],
          "examples": [
            "previous",
            {
              "filter": [
                {
                  "field": "Month",
                  "op": "=",
                  "value": "2026-09"
                }
              ]
            },
            {
              "value": 4
            }
          ]
        },
        "field": {
          "type": "string",
          "description": "A column that holds the change. The change is the metric's aggregate over the same rows of this column. An unknown name is a 'dataset-field-unknown' error."
        },
        "as": {
          "type": "string",
          "enum": [
            "difference",
            "percent"
          ],
          "default": "difference",
          "description": "With 'compare': the change as a difference (value minus base) or as a ratio ((value minus base) over the absolute base; 0.12 is 12%). With 'field': what the column holds, which only picks the default format."
        },
        "format": {
          "$ref": "#/$defs/NumberFormat",
          "description": "How the change is drawn, usually with sign sections ('+0.0;-0.0;0', '+0%;-0%;0%'). Absent: the value column's format with sign sections built from it ('+#,##0.##;-#,##0.##;0' without one), and '+0%;-0%;0%' for a percent."
        }
      }
    }