Evaluates the expression with a changed filter: TUDO() ignores the group, FILTRAR() narrows it.
| Field | Value |
|---|---|
| Category | Context and filter |
| Type | Aggregation (operates on a set of rows) |
| Arity | 1 to 9 arguments |
| Compiles to SQL (calculated column) | No |
| Version | Formula engine v3. |
Aliases#
Canonical name: CALCULAR. Accepted aliases (case-insensitive): calculate.
Syntax#
CALCULAR(expr; [arg2]; [arg3]; [arg4]; [arg5]; [arg6]; [arg7]; [arg8]; [arg9])All arguments are expressions.
Returns#
The value of the expression evaluated in the changed context.
Null handling#
When there is no row in the changed context, it returns blank (never zero) — a blank is more honest than a made-up zero.
Evaluation context#
Changes the filter context and ONLY THEN evaluates the expression (lazy evaluation) — that's why the result differs from evaluating the expression first.
Differences from DAX#
- DAX equivalent: CALCULATE
- Compatibility: DIFFERS from DAX — different semantics, watch out
- Note: Modifiers limited to the engine's repertoire (plain condition, FILTRAR, TUDO, TUDO_EXCETO, REMOVER_FILTROS, ENTRE_DATAS, DATAS_NO_PERIODO, TRATAR_COMO, PRIMEIROS_N). Operates on the visual's rows, with no tabular model.
Examples#
CALCULAR(SOMA(receita); FILTRAR(uf = "SP"))Example with values#
Input: sum ignoring the group filter (TUDO) → 100.
CALCULAR(SOMA(receita); TUDO()) → 100Expected result: 100
Business example#
Comparative measure — share of total, ranking, change versus another period.
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.