Skip to content

Automatic translation — the Portuguese version is the reference. View in Portuguese

DATADIF

On this page (10)

Difference between two dates in the chosen unit.

FieldValue
CategoryDate and time
TypeScalar (operates value by value)
Arity3 arguments (fixed)
Compiles to SQL (calculated column)Yes
VersionFormula engine v3.

Aliases#

Canonical name: DATADIF. Accepted aliases (case-insensitive): datediff.

Syntax#

code
DATADIF(expr; arg2; arg3)

All arguments are expressions.

Returns#

Number.

Null handling#

Invalid or missing dates become a friendly error or blank, depending on the function.

Evaluation context#

Scalar — evaluated on the result of the arguments (in calculated columns, it runs row by row).

Differences from DAX#

  • DAX equivalent: DATEDIFF
  • Compatibility: DIFFERS from DAX — different semantics, watch out
  • Note: Only the units DIA, MES, and ANO — DAX DATEDIFF has SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, and YEAR.

Examples#

code
DATADIF(pedido_em; entregue_em; "DIA")

Example with values#

Input: from 2025-01-01 to 2025-03-31, in days.

code
DATADIF("2025-01-01"; "2025-03-31"; "DIA")  →  89

Expected result: 89

Business example#

Delivery lead time in days, from order to delivery.

Common errors#

DATADIF: unidade deve ser "DIA", "MES" ou "ANO" · DATADIF: "…" não é uma data.


← Back to the formula index

Related links