# Dimensional expressions > Generated by `npm run gen:ai-pack` (scripts/ai-pack.ts) — do not edit. From `scripts/ai-pack-expressions.ts`: each meaning is quoted from the concept documents, and each example is tested — `check:ai-pack` runs the published checker on [the model the examples run on](dimensional-expressions.axmo.yaml) and compares every value below. Format version `ed0892bbbdf4`. A dimensional expression selects elements; it goes inside a series' filter `[…]` (`Sales[A | C]`) or stands as a dimension's argument (`SUM(Sales[Month[$1:0]])`). Offsets, absolute positions and element ranges are in the guide's part 03. This file adds the four forms the guide leaves out. **Where it is allowed** is what the examples measure. The examples run on one model: `Products` (`All_Products` → `A`, `B`, `C`) and `Time` (2027-01 to 2027-06, by month, quarter and year), with one input, `Sales`: | Product | 2027-01 | 2027-02 | 2027-03 | 2027-04 | 2027-05 | 2027-06 | |---|---|---|---|---|---|---| | A | 120 | 90 | 150 | 80 | | | | B | 60 | 200 | | 30 | | | | C | 10 | | 110 | | 40 | 5 | `Pick` is the constant `3`. An Output Range column below is named `/`; its rows are the products. ## Sets Union, intersection and difference of elements of one dimension, inside a filter `[…]`. **What the concept documents say:** > Three set operations over same-dimension element sets (ADR-052): > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §5 > | Operator | Meaning | Notes | > |---|---|---| > | `\|` | union | — | > | `&` | intersect | sigil `&` is lexically free — Axmo has no string-concat operator | > | `\` | difference | order-preserving, left-associative; round-trips through YAML without escaping | > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §5 > The three set operations are **peers** on one left-associative rung — union is not separated to a looser rung. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §5 > Parentheses override; they are **required** when a set operation feeds a following path segment (because `/` binds tighter): `(2026-Q1 | 2026-Q3)/Month`. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §5 **Where it is allowed:** in a series formula and in an Output Range expression — both measured below. | Expression | Written as | Values | |---|---|---| | `SUM(Sales[A \| C])` | the formula of series `Union` | 2027-01: 130 · 2027-03: 260 | | `SUM(Sales[(A \| B) & (B \| C)])` | the formula of series `Intersect` | 2027-01: 60 · 2027-02: 200 | | `SUM(Sales[Product \ B])` | the formula of series `Difference` | 2027-01: 130 · 2027-02: 90 | | `SUM(Sales[Month \ 2027-Q1/Month])` | the formula of series `Not Q1` | A: 80 · B: 30 · C: 45 | | `SUM(Sales[(2027-Q1 \| 2027-Q2)/Month])` | the formula of series `Q1 And Q2` | A: 440 | | `SUM(Sales[A \| C, Month[$1]])` | Output Range column `Report/Union_OR` | A: 130 · C: 130 | | `SUM(Sales[Month \ 2027-Q1/Month])` | Output Range column `Report/Not_Q1_OR` | A: 80 · B: 30 | ## Anchors The current element, its parent and its tree root, named by where the formula is evaluated. **What the concept documents say:** > Three anchors reference the **current coordinate**, not the whole dimension. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §4 > | current element | `.` | `.currentElement` | Linux cwd `.` | > | parent of current | `..` | `.parent` | Linux `..` | > | tree root of current | `~` | `.treeRoot` | Linux home `~` | > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §4 > An anchor may be qualified by a dimension name, exactly as any other path expression may: `Time/.`, `Time/..`, `Time/~`. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §4 > So `Revenue[..]` is ambiguous — *"parent in which dimension?"* — and forces `Revenue[Time/..]`. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §4 **Where it is allowed:** in a series formula and in an Output Range expression — both measured below. | Expression | Written as | Values | |---|---|---| | `Sales / Sales[Products/..]` | the formula of series `Share Of Parent` | A, 2027-01: 0.631578947368421 · C, 2027-05: 1 | | `Sales[Time/.]` | the formula of series `Here` | A, 2027-02: 90 | | `Sales[Time/..]` | the formula of series `Quarter Total` | A, 2027-02: 360 · A, 2027-04: 80 | | `SUM(Sales[Time/~/Month])` | the formula of series `Year Months` | B, 2027-06: 290 | | `Sales[2027-01] / Sales[Products/.., 2027-01]` | Output Range column `Report/Share_OR` | A: 0.631578947368421 | | `Sales[Time/..]` | Output Range column `Quarters/2027-02` | A: 360 · B: 260 | | `SUM(Sales[Time/~/Month])` | Output Range column `Years/2027-06` | C: 165 | **Refused:** - `Sales[..]`, as a series formula: `AMBIGUOUS_NAME` — Series "Refused": This expression does not say which dimension it belongs to. ".." could belong to any of "Products", "Time". Name the dimension — for example "Products/.." — or name a layer. - `SUM(Sales[2027-01/~/Month])`, as an Output Range column: `DEFINITION_VALIDITY_ERROR` — Series expression "Refused": the expression varies over dimension "Time" that is not in the output scope (not in Rows nor Columns). ## WHERE The elements whose value meets a condition — inside a series' filter `[…]`. **What the concept documents say:** > The moment selection consults a dataseries *value as a predicate*, it is `WHERE` and lives one layer up, inside a dataseries expression. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §0 > The result is one value per candidate. **`WHERE` drops** the candidates whose value is 0/false; **`INCLUDE` masks** them — same evaluation, only the tail action differs. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §0 > **No boolean *type*.** Truthiness is **numeric** — non-zero keeps, zero drops — exactly as `IF(5, …)` behaves. `WHERE Revenue` means "where `Revenue ≠ 0`"; a constant `WHERE 1` selects all. > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §0 **Where it is allowed:** in a series formula and in an Output Range expression — both measured below. | Expression | Written as | Values | |---|---|---| | `SUM(Sales[Month WHERE Sales > 100])` | the formula of series `Big Months` | A: 270 · B: 200 · C: 110 | | `MAX(Month Index[Month WHERE not ISEMPTY(Sales[All_Products])])` | the formula of series `Last Month With Data` | 6 | | `SUM(Sales[Month WHERE Sales > 100])` | Output Range column `Report/Big_OR` | A: 270 | | `MAX(Month Index[Month WHERE not ISEMPTY(GL Amount[All_PL, All_CostCentres])])` | the formula of series `Month Actual Index`, in the recipe [pl-from-ledger](../recipes/pl-from-ledger.model.yaml) | 3 | **Refused:** - `COUNT(Month WHERE Sales[All_Products] > 200)`, as a series formula: `PARSE_ERROR` — Series "Refused": Formula parse error: WHERE is permitted only inside data-series filters. Dimensional expressions are pure navigation. ## A position taken from an expression: $( … ) `Month[$(expr)]` is the element at the position `expr` computes, as `Month[$3]` is the third. **What the concept documents say:** > A **computed** position or offset (`[$(expr)]`, `[expr]`) is read by one rule (AGL8-18, `ADR-404`): a failed value fails the read; an **empty** or **not-in-range** value counts as **0**; a **fraction** is rounded as Excel's `ROUND(x, 0)` (halves away from zero — a written fraction too). So an empty offset is the **current** element, and an empty absolute position is `$0` (§12). > > — `SYSTEM-CONCEPT-DIMENSIONS.md` §3.2 > **A negative position counts from the end**: `$-1` is the last element. A position past either end selects nothing: the cell is **not in range** (§4.2), so it reads empty and nothing is reported — `Revenue[Month[$(Index + 5)]]` with `Index` at 3 in a six-month model is position 8, and an Output Range column written so is empty, with no message (ADR-464). > > — `SYSTEM-CONCEPT-AND-MODELING-LANGUAGE.md` §5.3 **Where it is allowed:** in a series formula and in an Output Range expression — both measured below. | Expression | Written as | Values | |---|---|---| | `Sales[Month[$(Pick)]]` | the formula of series `Picked` | A: 150 · C: 110 | | `SUM(Sales[Month[$1:$(Pick)]])` | the formula of series `To Picked` | A: 360 · B: 260 | | `Sales[Month[$(Pick + 10)]]` | the formula of series `Past End` | nothing, at every product: no value and no message | | `Sales[Month[$(Pick - 10)]]` | the formula of series `Before Start` | nothing, at every product: no value and no message | | `Sales[Month[$(Pick)]]` | Output Range column `Report/Picked_OR` | A: 150 · B: (empty) · C: 110 | | `Sales[Month[$(Pick + 10)]]` | Output Range column `Report/Past_End_OR` | A: (empty) · B: (empty) · C: (empty) | | `Actual[All_CostCentres, Month[$(Month Actual Index)]]` | Output Range column `A Month and YTD/Actual_Month`, in the recipe [pl-from-ledger](../recipes/pl-from-ledger.model.yaml) | Revenue: 70940 · Gross profit: 64078.869999999995 |