Skip to content

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

DESLOCAR_PERIODO

On this page (10)

The same measure N periods before/after (unit: d, m, or a).

FieldValue
CategoryDate and time
TypeAggregation (operates on a set of rows)
Arity3 to 4 arguments
Compiles to SQL (calculated column)No
VersionFormula engine v3, with fiscal/4-4-5 calendar support.

Aliases#

Canonical name: DESLOCAR_PERIODO. Accepted aliases (case-insensitive): dateadd.

Syntax#

code
DESLOCAR_PERIODO(expr; arg2; arg3; [arg4])

All arguments are expressions.

Returns#

The measure's value in the shifted period, or blank.

Null handling#

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

Evaluation context#

Time intelligence — finds the group's reference date and re-evaluates the measure over the VISUAL's rows (uses allRows) that fall within the window. Switches to fiscal/4-4-5 when the model has that calendar.

Differences from DAX#

  • DAX equivalent: DATEADD
  • Compatibility: DIFFERS from DAX — different semantics, watch out
  • Note: Units d/m/a; operates on the visual's rows and doesn't require contiguous dates like DATEADD.

Examples#

code
DESLOCAR_PERIODO(SOMA(receita); dia; -1; "m")

Example with values#

Input: group March/25 shifted -1 year.

code
DESLOCAR_PERIODO(SOMA(receita); dia; -1; "a")  →  100

Expected result: 100

Business example#

Time analysis — order age, accrual month/year, accounting close.

Common errors#

Typos in a column name, an incompatible type, or an invalid argument become a friendly message (pt-BR) — the engine never silently returns a wrong number.


← Back to the formula index

Related links