Skip to content

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

Updated on 2026-10-03

Measures, formulas and KPIs

The formula language in Portuguese, the formula editor, the editor's formula bar, the measures library, calculation groups, parameters, KPIs and grouping.

On this page (9)

This is where you define the numbers: reusable measures, the formula language (DAX-style, in Portuguese), calculation groups, "what-if" parameters, KPIs and grouping. Examples use the synthetic workspace Comércio Aurora Ltda.


Formula language (DAX-like, in Portuguese)#

  1. What it is — a formula language with Portuguese names (SOMA, SE, ACUM_ANO, CLASSIFICAR) and English aliases, with filter context and time intelligence, comparable to DAX.

  2. When to use it — creating measures such as "Revenue YTD", "Change vs last year", "Product ranking", "Share of total".

  3. How it works — an in-house parser (tokenizer → AST, no eval) and three evaluators: aggregate, row by row and compilation to datalake SQL. There are 102 functions in 7 categories: math, statistics/aggregation, logic, text, date, filter context (CALCULAR, TUDO, FILTRAR, REMOVER_FILTROS, the SOMAX/MEDIAX iterators, CLASSIFICAR, PROCV, VALOR_SELECIONADO, PRIMEIROS_N…) and time intelligence (ACUM_ANO, MESMO_PERIODO_ANO_ANTERIOR, DESLOCAR_PERIODO, SALDO_FINAL…). Brazilian syntax: arguments separated by ;, comma as the decimal separator, VAR … RETORNAR, concatenation with &. Division by zero → EMPTY; lazy evaluation in the filter context; DATA − DATA (date minus date) gives a teaching error asking for DATADIF.

  4. Prerequisites — columns/measures in the model to reference.

  5. How to validate — create Receita = SOMA(valor) and Receita YTD = ACUM_ANO(MEDIDA('Receita'); calendario.data); put both in a visual by month and confirm the running total growing within the year and resetting at the turn of the year.

  6. Limits and caveats — it's a genuine DAX-like language (real filter context), not full DAX: there are no virtual tables in the engine and relationships live in SQL. We don't claim full parity with DAX.

  7. Sample data (synthetic)

    monthReceitaReceita YTD
    2026-0110001000
    2026-0215002500
  8. Evidence — formula engine covered by an extensive deterministic suite (filter context, ranking, time intelligence, matrix, fiscal calendar, transition) and frozen by the reference test suite, with an identical result on every run.


Formula editor (autocomplete + live validation)#

  1. What it is — an editor with autocomplete, live validation and help/example per function.
  2. When to use it — when writing any measure or calculated column.
  3. How it works — it validates as you type, with FormulaError in pt-BR; it blocks classic mistakes (e.g., "coluna solta em medida agregada" — bare column in an aggregated measure).
  4. Prerequisites — nothing beyond the model.
  5. How to validate — start typing CLASS… and confirm the CLASSIFICAR suggestion; write an invalid measure and see the error in Portuguese.
  6. Limits and caveats — validation is local syntax/semantics; the real cost of the query only appears at execution.
  7. Sample data (synthetic) — Ticket médio = DIVIDIR(MEDIDA('Receita'); CONT(vendas.id)).
  8. Evidence — formula validation engine (errors in pt-BR) covered by a deterministic suite; the editor's rendering has no visual test.

How the formula editor appears on screen

The editor opens on top of the pane, with room for the formula, the search and the preview. It's the same for New measure (formula), New calculated column and Edit formula (see Fields, measures and variables).

  • The technical name (letters, numbers and _ only), by which another formula calls this one, and the display name on the card, which can have spaces, accents and %.
  • How the number appears: 0.00 · Number, K/M · Short number, % · Percentage, R$ · Currency, R$ K/M · Short currency.
  • "Search function…" searches the functions by category. Each function also shows the equivalent Power BI name (for example, ARRED and ROUND) — the engine accepts both.
  • Existing measures are at hand to use in the formula.
  • The preview uses the same format as the card: what you see is what will appear.
  • Save, Cancel and, on an existing formula, Delete (with confirmation).
Formula editor open, with the name, the display name on the card, the function search and the preview

The formula bar

In edit mode, right below the menu bar, there's a bar the width of the screen. Click a field in the Values list of the visual pane and it shows where it comes from: tabela.coluna, the measure's formula, or a notice that the data hasn't arrived yet. With no field chosen, it says "Click a field in the values list to see where it comes from."

  • Drag the bottom edge to stretch the bar and read long formulas.
  • Double-click the edge to go back to the default size.
  • The × clears it.
Formula bar stretched, showing a measure's formula

Central measures library#

  1. What it is — measures declared once in the model and reused by reference (another measure cites MEDIDA('Receita'); the widget cites measureId).
  2. When to use it — to put an end to "average ticket" typed into 10 widgets silently drifting apart.
  3. How it works — CRUD with an impact report (who uses the measure), a dependency graph and cycle detection with the full path; folders, description, certified badge, hidden. Cleanup on the write path (cleanModelForSave).
  4. Prerequisites — the dashboard's model (or the workspace's central model).
  5. How to validate — create the central measure "Receita"; use it in three visuals; edit the formula and confirm, in the impact report, the three visuals listed before saving.
  6. Limits and caveats — the library across dashboards depends on the workspace central model (see Semantic model).
  7. Sample data (synthetic) — "Receita" (used in 3 widgets) → "Ticket médio" citing MEDIDA('Receita').
  8. Evidence — measures library and impact report (dependency graph + cycle detection) covered by a deterministic suite.

Calculation groups#

  1. What it is — a group (e.g., "Time" with the items Actual / Last year / YTD) that applies to any measure without rewriting the formula.
  2. When to use it — offering "Actual × Last year × YTD" for all measures from a single selector.
  3. How it works — MEDIDA in the item is replaced by the base measure. When two groups apply to the same measure (e.g., "Time" × "Currency"), the order follows deterministic precedence: higher precedence = outermost function. Errors are never a silent choice: a nonexistent or repeated group/item, or a precedence tie, is refused (as in Power BI).
  4. Prerequisites — at least one base measure and the declared group.
  5. How to validate — create the "Time" and "Currency" groups with different precedences; apply both to "Receita" and confirm the nesting in the expected order; force equal precedences and see the refusal due to a tie.
  6. Limits and caveats — only text assembly (nothing is evaluated here); the reference test suite stays identical.
  7. Sample data (synthetic) — "Time"[YTD] × "Currency"[USD] over "Receita".
  8. Evidence — calculation groups (deterministic precedence, refusal of ties) covered by a deterministic suite and frozen by the reference test suite.

Parameters (field, measure and what-if)#

  1. What it is — centralized parameters of three types: field (switches which field the visual uses), measure (chooses which central measure to show) and what-if (a named number, "what if the discount were X%").
  2. When to use it — a "view by: revenue · orders · ticket" selector that replaces three nearly identical visuals; or simulating discount scenarios.
  3. How it works — declared once in the model with a stable p… id; the reader's selection travels in the URL/bookmark (it doesn't stay in the model), so renaming the parameter doesn't break the saved state.
  4. Prerequisites — fields/measures to offer; for what-if, the measure that consumes the number.
  5. How to validate — create a "View by" field parameter with [revenue, orders, ticket] and confirm that switching the option changes the visual's series; share the URL and confirm the choice is restored.
  6. Limits and caveats — a parameter slicer doesn't slice rows (it switches field/measure/value); slicing rows is the job of the other slicers (see Filters and interactions).
  7. Sample data (synthetic) — what-if desconto = 10% applied to "Receita líquida = MEDIDA('Receita') * (1 - desconto)".
  8. Evidence — parameters (field/measure/what-if) and their application to the visual covered by a deterministic suite; the reader's selection travels in the URL state.

KPIs in the model#

  1. What it is — the semantic model's KPI: a target value built into the dashboard's indicator, with direction and formatting.
  2. When to use it — when the dashboard needs to show "actual vs target" on the visual itself.
  3. How it works — the target lives in the KPI (semantic model) and the visual draws the comparison. It doesn't depend on a separate screen.
  4. Limits and caveats — the KPI doesn't fire alerts on its own; alerts are set per visual — see Export and distribution.
  5. Historical note — there used to be a Targets (scorecard) screen at /metas, with targets registered separately (target, deadline, owner). It was removed from the product on 09/26/2026; target tracking today is the dashboard's KPI.

Grouping and binning#

  1. What it is — grouping values into bins (by width or count), lists or clusters.
  2. When to use it — turning a continuous ticket into bins ("0-50", "50-100", "100+") or grouping cities into a "Capitals" list.
  3. How it works — bins by width/count, grouping by list and cluster, applicable to the visual's dimensions.
  4. Prerequisites — the column to group in the model.
  5. How to validate — create bins of valor with width 50 and confirm the buckets in a histogram.
  6. Limits and caveats — binning works on the data from the visual's snapshot/query.
  7. Sample data (synthetic) — values {30, 60, 120} → bins {"0-50":1, "50-100":1, "100+":1}.
  8. Evidence — grouping and binning (bins, lists, clusters) covered by a deterministic suite.

Related links