# Add a calculated column

Shape / columns

new column from a formula or expression

Page: <https://meridian.online/operations/add-a-calculated-column>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

a column from an expression

It reads the `orders` table the proofs share. Create it first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);
```

Then run the statement:

```sql
CREATE TEMP TABLE result AS
SELECT order_id, amount, round(amount * 1.2, 2) AS gross FROM orders;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT max(gross) FILTER (WHERE order_id = 1) = 144 AND count(gross) = 9 FROM result)) THEN 'as expected' ELSE error('gross is not amount times 1.2') END AS verdict;
```

It needs nothing installed beyond DuckDB itself.

## Variants

- Add a column from an expression: Add a column whose value for each row is computed by an expression over that row's columns.
- Add a constant or empty column: Add a column holding the same literal value, or no value, in every row.
- [Copy a column](https://meridian.online/operations/add-a-calculated-column/copy-a-column): Add a copy of an existing column under a new name.
- [Stamp rows with load metadata](https://meridian.online/operations/add-a-calculated-column/stamp-rows-with-load-metadata): Add columns recording where and when each row was loaded, such as a timestamp, source file, batch id or change kind.
- [Apply one formula to many columns](https://meridian.online/operations/add-a-calculated-column/apply-a-formula-to-many-columns): Apply the same expression to each of a set of columns, creating or updating one column per input.
- [Overwrite a column with a formula](https://meridian.online/operations/add-a-calculated-column/overwrite-a-column): Replace the values of an existing column with the result of an expression or another column's values, adding no column.
- [Aggregate across columns in each row](https://meridian.online/operations/add-a-calculated-column/aggregate-across-columns): Combine the values of several columns within each row, such as their sum, mean or maximum, into a new column.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Azure Data Factory: [`Adding and Transforming Columns`](https://learn.microsoft.com/en-us/azure/data-factory/wrangling-functions) (read 2026-09-27)
- Azure Data Factory: [`Derived column`](https://learn.microsoft.com/en-us/azure/data-factory/data-flow-derived-column) (read 2026-09-27)
- Azure Data Factory: [`Expression functions`](https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expression-functions) (read 2026-09-27)
- Alteryx Designer: [`Formula`](https://help.alteryx.com/current/en/designer/tools/preparation/formula-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Formula In-DB`](https://help.alteryx.com/current/en/designer/tools/in-database/formula-in-db-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Multi-Field Formula`](https://help.alteryx.com/current/en/designer/tools/preparation/multi-field-formula-tool.html) (read 2026-09-27)
- Bruin: [`Dimensions`](https://getbruin.com/docs/bruin/core-concepts/semantic-layer.html) (read 2026-09-27)
- Apache DataFusion: [`Comparison Operators`](https://datafusion.apache.org/user-guide/sql/operators.html) (read 2026-09-27)
- Apache DataFusion: [`EXTEND`](https://datafusion.apache.org/user-guide/sql/select.html) (read 2026-09-27)
- Apache DataFusion: [`Logical Operators`](https://datafusion.apache.org/user-guide/sql/operators.html) (read 2026-09-27)
- Apache DataFusion: [`Other Operators`](https://datafusion.apache.org/user-guide/sql/operators.html) (read 2026-09-27)
- Apache DataFusion: [`with_column`](https://docs.rs/datafusion/latest/datafusion/dataframe/struct.DataFrame.html) (read 2026-09-27)
- dbt-utils: [`Comparison functions`](https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros) (read 2026-09-27)
- DuckDB: [`Lambda Functions (family)`](https://duckdb.org/docs/current/sql/functions/lambda) (read 2026-09-27)
- Duckle: [`Add Column`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Audit Stamp`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Compare Columns`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Format String`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Length`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Repeat`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Reverse`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Substring`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Text Match`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- EasyMorph: [`Calculate new column(s)`](https://help.easymorph.com/doku.php?id=transformations:addcolumn) (read 2026-09-27)
- EasyMorph: [`Modify column(s)`](https://help.easymorph.com/doku.php?id=transformations:replacecolumns) (read 2026-09-27)
- AWS Glue: [`Add Current Timestamp`](https://docs.aws.amazon.com/glue/latest/dg/transforms-add-current-timestamp.html) (read 2026-09-27)
- AWS Glue: [`Derived Column`](https://docs.aws.amazon.com/glue/latest/dg/transforms-derived-column.html) (read 2026-09-27)
- Apache Hop: [`Add Constants`](https://hop.apache.org/manual/latest/pipeline/transforms/addconstant.html) (read 2026-09-27)
- Apache Hop: [`Calculator`](https://hop.apache.org/manual/latest/pipeline/transforms/calculator.html) (read 2026-09-27)
- Apache Hop: [`Formula`](https://hop.apache.org/manual/latest/pipeline/transforms/formula.html) (read 2026-09-27)
- Apache Hop: [`Set field Value to a field`](https://hop.apache.org/manual/latest/pipeline/transforms/setvaluefield.html) (read 2026-09-27)
- Apache Hop: [`Set field value to a constant`](https://hop.apache.org/manual/latest/pipeline/transforms/setvalueconstant.html) (read 2026-09-27)
- Apache Hop: [`User Defined Java Expression`](https://hop.apache.org/manual/latest/pipeline/transforms/userdefinedjavaexpression.html) (read 2026-09-27)
- Ibis: [`Literal`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/generic.py) (read 2026-09-27)
- KNIME Analytics Platform: [`Column Aggregator`](https://api.hub.knime.com/nodes/*wiIVn14C9BeYBHqr?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Constant Value Column Appender`](https://api.hub.knime.com/nodes/*SOVL9VDYc7uJBbiG?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Expression`](https://api.hub.knime.com/nodes/*Ls5yIzatVMzhFnzu?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`KNIME Column Expressions (legacy) (extension)`](https://api.hub.knime.com/extensions/org.knime.features.expressions) (read 2026-09-27)
- KNIME Analytics Platform: [`Renderer to Image`](https://api.hub.knime.com/nodes/*Cpb4v00GcqcQjAon?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String Manipulation`](https://api.hub.knime.com/nodes/*eOn8ibZnxIkY7XhT?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String Manipulation (Multi Column)`](https://api.hub.knime.com/nodes/*XHEmLNBRrffGaxF4?details=full) (read 2026-09-27)
- Apache NiFi: [`Evaluating Multiple Attributes`](https://nifi.apache.org/nifi-docs/expression-language-guide.html) (read 2026-09-27)
- Apache NiFi: [`Standalone Functions`](https://nifi.apache.org/nifi-docs/record-path-guide.html) (read 2026-09-27)
- Apache NiFi: [`Subjectless Functions`](https://nifi.apache.org/nifi-docs/expression-language-guide.html) (read 2026-09-27)
- Apache NiFi: [`UpdateAttribute`](https://nifi.apache.org/components/org.apache.nifi.processors.attributes.UpdateAttribute/) (read 2026-09-27)
- Apache NiFi: [`UpdateRecord`](https://nifi.apache.org/components/org.apache.nifi.processors.standard.UpdateRecord/) (read 2026-09-27)
- OpenRefine: [`Add column based on this column…`](https://openrefine.org/docs/manual/columnediting#add-column-based-on-this-column) (read 2026-09-27)
- OpenRefine: [`Add column with URLs of matched entities`](https://github.com/OpenRefine/OpenRefine/blob/master/main/webapp/modules/core/scripts/views/data-table/menu-reconcile.js) (read 2026-09-27)
- OpenRefine: [`Add entity identifiers column`](https://openrefine.org/docs/manual/reconciling#add-entity-identifiers-column) (read 2026-09-27)
- OpenRefine: [`Other functions`](https://openrefine.org/docs/manual/grelfunctions#other-functions) (read 2026-09-27)
- OpenRefine: [`String functions`](https://openrefine.org/docs/manual/grelfunctions#string-functions) (read 2026-09-27)
- OpenRefine: [`Transform…`](https://openrefine.org/docs/manual/cellediting#transform) (read 2026-09-27)
- Pentaho Data Integration: [`Add constants`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Calculator`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Formula`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Set Field Value`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Set Field Value to a Constant`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`User Defined Java Expression`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Polars: [`DataFrame.fold`](https://docs.pola.rs/api/python/stable/reference/dataframe/computation.html) (read 2026-09-27)
- Polars: [`DataFrame.insert_column`](https://docs.pola.rs/api/python/stable/reference/dataframe/modify_select.html) (read 2026-09-27)
- Polars: [`DataFrame.replace_column`](https://docs.pola.rs/api/python/stable/reference/dataframe/modify_select.html) (read 2026-09-27)
- Polars: [`DataFrame.with_columns`](https://docs.pola.rs/api/python/stable/reference/dataframe/modify_select.html) (read 2026-09-27)
- Polars: [`DataFrame.with_columns_seq`](https://docs.pola.rs/api/python/stable/reference/dataframe/modify_select.html) (read 2026-09-27)
- Polars: [`Expr computation: position lookups (group)`](https://docs.pola.rs/api/python/stable/reference/expressions/computation.html) (read 2026-09-27)
- Polars: [`fold`](https://docs.pola.rs/api/python/stable/reference/expressions/functions.html) (read 2026-09-27)
- Polars: [`lit`](https://docs.pola.rs/api/python/stable/reference/expressions/functions.html) (read 2026-09-27)
- Polars: [`reduce`](https://docs.pola.rs/api/python/stable/reference/expressions/functions.html) (read 2026-09-27)
- Power Query M: [`Table.AddColumn`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.DuplicateColumn`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#column-operations) (read 2026-09-27)
- Power Query M: [`Table.TransformColumns`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.TransformRows`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Value functions`](https://learn.microsoft.com/en-us/powerquery-m/value-functions) (read 2026-09-27)
- RapidMiner Studio: [`Aggregate Token Length`](https://docs.rapidminer.com/latest/studio/operators/extensions/Text%20Processing/extraction/aggregate_token_length.html) (read 2026-09-27)
- RapidMiner Studio: [`Extract Length`](https://docs.rapidminer.com/latest/studio/operators/extensions/Text%20Processing/extraction/extract_length.html) (read 2026-09-27)
- RapidMiner Studio: [`Extract Token Number`](https://docs.rapidminer.com/latest/studio/operators/extensions/Text%20Processing/extraction/extract_token_number.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Aggregation`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/generation/generate_aggregation.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Aggregation (Advanced)`](https://docs.rapidminer.com/latest/studio/operators/extensions/Operator%20Toolbox/blending/generate_aggregation_advanced.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Attributes`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/generation/generate_columns.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Attributes (In Database)`](https://docs.rapidminer.com/latest/studio/operators/extensions/In-Database%20Processing/indb_blending/indb_generate_attributes.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Copy`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/generation/generate_copy.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Empty Attribute`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/generation/generate_empty_attribute.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Function Set`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/generation/generate_function_set.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Levenshtein Distance`](https://docs.rapidminer.com/latest/studio/operators/extensions/Operator%20Toolbox/blending/attribute_generation/levenshtein_distance.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Prompts`](https://docs.rapidminer.com/latest/studio/operators/extensions/Generative%20Models/Prompts/generate_prompts.html) (read 2026-09-27)
- Apache SeaTunnel: [`Copy`](https://seatunnel.apache.org/docs/2.3.13/transforms/copy) (read 2026-09-27)
- Apache SeaTunnel: [`Metadata`](https://seatunnel.apache.org/docs/2.3.13/transforms/metadata) (read 2026-09-27)
- Apache SeaTunnel: [`RowKindExtractor`](https://seatunnel.apache.org/docs/2.3.13/transforms/rowkind-extractor) (read 2026-09-27)
- Tableau Prep: [`Clean Step`](https://help.tableau.com/current/prep/en-us/prep_build_flow.htm) (read 2026-09-27)
- Tableau Prep: [`Create Calculated Field`](https://help.tableau.com/current/prep/en-us/prep_clean.htm) (read 2026-09-27)
- Tableau Prep: [`Custom Calculation`](https://help.tableau.com/current/prep/en-us/prep_calculations.htm) (read 2026-09-27)
- Tableau Prep: [`Duplicate Field`](https://help.tableau.com/current/prep/en-us/prep_clean.htm) (read 2026-09-27)
- Talend: [`tMap`](https://help.qlik.com/talend/en-US/components/8.0/tmap/tmap-component) (read 2026-09-27)
- Trifacta: [`Derive Transform`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/language-appendices/transforms.html) (read 2026-09-27)
- Trifacta: [`Edit with formula`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- Trifacta: [`New formula`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- Trifacta: [`Other Functions (group)`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/other-functions.html) (read 2026-09-27)
- Trifacta: [`Set Transform`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/language-appendices/transforms.html) (read 2026-09-27)
- Trifacta: [`filepath`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- VisiData: [`addcol-audiometadata`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/features/addcol_audiometadata.py#L39) (read 2026-09-23)
- VisiData: [`addcol-bulk`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/modify.py#L360) (read 2026-09-23)
- VisiData: [`addcol-expr`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/expr.py#L113) (read 2026-09-23)
- VisiData: [`addcol-iter`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/expr.py#L117) (read 2026-09-23)
- VisiData: [`addcol-new`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/modify.py#L359) (read 2026-09-23)
- VisiData: [`addcol-source`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1328) (read 2026-09-23)
- VisiData: [`setcell-expr`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/expr.py#L115) (read 2026-09-23)
- VisiData: [`setcol-expr`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/expr.py#L114) (read 2026-09-23)
- VisiData: [`setcol-iter`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/expr.py#L116) (read 2026-09-23)
