XCubes

Formulas

A formula item computes its value from an expression written in the XCubes formula language. Formulas are attached to individual items in a dimension; the engine evaluates them when the cube is computed.

Basic expressions

A formula references sibling items by their code. Codes that start with a letter and contain only letters, digits, and underscores can be written bare. Numeric codes and codes with special characters must be wrapped in double quotes.

Revenue - COGS
"620200" + "22520"
"R&D" + "G&A"

The standard arithmetic operators +, -, *, / work as expected. Parentheses control precedence.

Summing multiple items

To sum a fixed list of items, write an explicit + chain:

ProductSales + ServiceSales + OtherRevenue

This is clearer and more predictable than SetSum(), which takes wildcard patterns (SetSum("Sales*")) and matches by code prefix. Reserve SetSum() for true wildcard aggregations ("everything starting with 6") rather than enumerated lists.

The self keyword

Inside time-series functions (YTD, Rolling, Lag, etc.), the keyword self refers to the current item evaluated at an adjacent time period — you do not need to repeat the item's own code. For example, YTD(self) accumulates the current item from the start of the year to the current month.

Function arguments use semicolons

Arguments to all functions are separated by semicolons (;), not commas:

Lag(Revenue; 1)
If(Condition; TrueValue; FalseValue)

Item codes vs. reference names

Plain identifiers in a formula refer to sibling items in the same dimension. The functions Reference(), Prior(), and PriorDelta() take a reference name (a string in double quotes) that is resolved through the cube's registered cross-cube references — they do not refer to items. See Cube references.

Full function list

XCubes ships with functions for aggregation, math, logic, time-series navigation, and cross-cube lookups. The complete list with signatures and examples is in the Formula function reference.