Formula

This processor computes new columns using formulas based on other columns (like in a spreadsheet). The formula language provides:

  • Math functions

  • String manipulation functions

  • Date handling functions

  • Boolean and conditional expressions for rules creation

Usage examples

  • Compute a numerical expression: (col1 + col2) / 2 * log(col3)

  • Manipulate strings : toLowercase(substring(strip(mytext), 0, 7))

  • Create a rule-based column: if (width > height, "wide", "tall")

Errors and empty results

With the Dataiku DSS engine, a formula that returns null or an error leaves the output cell unchanged. If the output column is new, the cell stays empty. An empty string result clears the output cell.

Specify an Error column to store formula evaluation errors for each row. The error column is not supported by the SQL engine or native Spark execution.

Previous rows

With the Dataiku DSS engine, val, strval, and numval can read values from previous rows. For example, val("amount", 0, 1) returns the previous row’s amount, or 0 when it is unavailable. See Formula language for the offset argument and its limits.

Getting help

The formula editor provides live syntax checking, preview of results, a complete language reference, and examples.