Calculated columns let you create derived metrics directly within a widget, using simple arithmetic on existing column values. Use them to add variance, variance %, margin, growth rate, or any other calculation that builds on the data already in your widget, without changing your underlying Cube data model.
Overview
A calculated column is a custom column you define inside a widget. It evaluates a formula against the values in each row and displays the result as a new column. Calculated columns are scoped to the widget where they're created: they don't write back to Cube, don't appear in other widgets, and don't affect the underlying data model.
Calculated columns are available on every widget type except Text. On Table widgets, they appear as a new column in the table. On Bar, Line, Combo, Row, and Waterfall widgets, they render on the chart as an additional series alongside your other columns. On Pie, Donut, Metric, and Trend widgets, they appear in the table preview but do not render on the chart visual itself.
Adding a calculated column
The "+" button to add a calculated column is available in the table preview section of the widget Preview modal, across all tabs (Edit Data, Style, Format Details).
- Table widgets: The "+" appears at the right edge of the column header row in the main table view.
- Chart widgets (Bar, Line, Pie, etc.): Toggle on Table Preview below the chart visual. The "+" appears at the right edge of the table preview's column header row.
To add a calculated column:
- Click the "+" button. A new column is added with an inline formula bar.
- Type = to begin the formula.
- Build the formula using any combination of:
- Column references: Click any column header to insert that column's reference into the formula bar. The reference appears as a bracketed label (see Writing formulas below).
- Static numbers: Type any numeric value directly (e.g.,
100,0.5,1.15). - Arithmetic operators: Type +, -, *, or / to combine references and numbers.
- Press Enter to save the formula. Calculated values render for every row in the column.
You can name the column by clicking the column header at any point: before, during, or after entering the formula.
Column references can only be added by clicking cells. Typing a column name into the formula bar will not create a valid reference.
Writing formulas
Formulas use square-bracketed labels to reference columns. References are inserted by clicking column headers, which will put the column reference in the formula bar. The label that appears reflects the dimension values of the column you clicked.
Single dimension on Columns: When only one dimension is on Columns, clicking a cell inserts a single-value reference with no comma.
=[Net Income] / [Revenue]
Multiple dimensions on Columns: When two or more dimensions are on Columns, clicking a cell inserts a comma-separated reference with each dimension value in the order they appear.
=[All Products, Q1-25] - [All Products, Q2-25]
Supported operators: +, -, *, /
Same-row only: You can only use one formula per column. Each row evaluates the formula independently using its own values. For example, if the formula is =[Budget] - [Actuals], each row displays the difference between that row's Budget and Actuals values.
Example formulas
| Calculation | Formula |
|---|---|
| Net Income Margin | =[Net Income] / [Revenue] |
| Variance (Actuals vs. Budget) | =[Actuals] - [Budget] |
| Variance % | =([Actuals] - [Budget]) / [Budget] |
| Quarter-over-quarter change | =[All Products, Q2-25] - [All Products, Q1-25] |
| Cost with 15% markup | =[Cost] * 1.15 |
Referencing other calculated columns
A calculated column can reference another calculated column, as long as the referenced column is defined first.
To reference an existing calculated column, click its column header the same way you would any other column. The reference is inserted as a bracketed label using the calculated column's name.
Example: build a "Variance" column, then build a "Variance %" column that references it.
| Step | Column Name | Formula |
|---|---|---|
| 1 | Variance | =[Actuals] - [Budget] |
| 2 | Variance % | =[Variance] / [Budget] |
Managing calculated columns
Rename: Click the column name to edit it inline.
Reorder: Drag a calculated column to a new position relative to other columns.
Delete: Remove a calculated column from the widget. If the column is referenced by another calculated column, you'll see a warning before deletion proceeds. Confirming the delete also deletes any calculated columns that depend on it.
Validation and errors
Cube validates the formula when you press Enter to save:
- Empty formula: If you save with no formula entered, an inline validation error appears and the save is blocked.
- Invalid formula: Incomplete expressions, unsupported syntax, divide-by-zero, and circular references all surface inline validation errors and block the save.
How calculated columns appear in different widget types
| Widget type | Appears in chart visual | Appears in table preview |
|---|---|---|
| Table | N/A | Yes, as a new column |
| Bar, Line, Combo, Row, Waterfall | Yes, as an additional series | Yes |
| Trend | Yes, as a comparison column with variance against the base | Yes |
| Pie, Donut | No | Yes |
| Metric | No | Yes |
| Text | Not supported | Not supported |
For Pie, Donut, and Metric widgets, the calculated column persists in the table preview but does not render on the chart visual. Row-level calculations that would extend chart visualization to these widget types are planned for a future release.
Limitations
- Same-row references only. Cross-row formulas (e.g., summing values across multiple rows) are not supported.
- Arithmetic operators only. Functions like IF, SUM, and AVERAGE are not yet available.
- Widget-scoped. Calculated columns persist with the widget they were created in. They do not write back to Cube and are not surfaced in any other widget or surface.
- Not available on Text widgets.