PT EN
Back to site

DATTA BI — Drill-down and drill-up

A chart by state answers "where is the problem?" — but the next question is always "and inside the state?". With drill-down, the visual itself answers: double-click a bar and it goes one level down the hierarchy (state → municipality → neighborhood), filtering by the clicked category. Drill-up goes back one level with a click. It all happens inside the card, without leaving the dashboard and without rewriting the query by hand.

How to enable it

Create the hierarchy in the dashboard's Model, Hierarquias (hierarchies) tab — from the most aggregated level to the most detailed, for example uf → municipio → bairro — and put one of its columns on the visual's Axis. The visual goes down from the axis column: with the axis on municipio, the double click goes to bairro. On pie, donut, treemap and funnel the column goes in the Categoria (category). Nothing changes in the visual; the hierarchy applies to every visual with drill-down over that dataset (bars, line, area, waterfall, pie, donut, treemap and funnel).

For a visual with its own sequence, declare it in the drillX field of the visual's channel configuration (bindingsJson) — it takes precedence over the Model hierarchy:

json
{
  "x": { "column": "uf" },
  "y": { "column": "id", "agg": "COUNT" },
  "limit": 30,
  "drillX": ["uf", "municipio", "bairro"]
}

How to use it

  • Going down (drill-down): double-click a bar (vertical, horizontal or stacked), a column of the line or area chart, a waterfall step, a pie or donut slice, a treemap block or a funnel stage. The visual re-renders, filtering by the clicked category and grouping by the next level of the hierarchy.
  • Going up (drill-up): a trail appears at the top of the card with the ↑ arrow — click it to go back one level.
  • Back to the start: keep clicking ↑ until the root level; the entire dashboard re-renders.
  • Single click on the same visual: on a visual with a hierarchy, the single click (cross-filter) waits a quarter of a second before filtering — the time it takes to know whether it is the first click of a double click, which only goes down a level and leaves the dashboard filter alone. On a visual without a hierarchy, the click filters right away.

Hands-on example — from state to neighborhood in three clicks

  1. On a "Beneficiários por UF" visual with the hierarchy ["uf", "municipio", "bairro"], double-click the BA bar.
  2. The visual now shows Bahia's municipalities; a double-click on Salvador goes down to neighborhoods.
  3. The trail at the top of the card shows the path taken — click ↑ to go back to Salvador, and again to return to the by-state view.

How the filter reaches the query

When you go down a level, the platform reuses the visual's saved configuration and overrides only what changed: the axis becomes the next level of the hierarchy and the clicked category is added as an accumulated filter. The override happens on the first-level keys of the configuration — whatever you did not touch keeps applying — and the accumulated filters become a |> FILTER (column = "value") AND ... condition in the generated DATTAX query, before the grouping. Each step of the path goes in with the column of the level where it was clicked: going down through BA and then Salvador becomes (uf = "BA") AND (municipio = "Salvador"). The dashboard's saved filters and the active cross-filter join the same condition: the detailed level respects what the rest of the dashboard shows.

The platform also exposes an endpoint that renders a visual with the drill already applied, taking the chosen category and the target level — useful for integrations that build the navigation outside the screen. See the API reference.

Date table: automatic hierarchy

In a dataset marked as a date table in the Model, a bar, line or area visual whose axis is the date column needs no declared hierarchy: it opens by year and drills down to quarter, month and day. The levels are computed in the query (DATTAX YEAR, QUARTER, MONTH, DAY). See Relationships.

Limitations

  • Drill-down works on bars, line, area, waterfall, pie, donut, treemap and funnel built from a dataset and the channels (datasetId + bindingsJson), with at least two levels from the axis column on — the Eixo X (X axis) on axis charts, the Categoria (label) on pie, donut, treemap and funnel — in the Model hierarchy or in drillX. Heatmap and scatter do not go down (two axes; a numeric axis), nor do radar, box plot, candlestick and calendar. Visuals with a handwritten DATTAX script ignore the override and render the script literally — on them the double click does not go down a level.
  • The maximum depth is the last level of the hierarchy (or of drillX). When you try to go past the last level, the visual shows the notice "Nível mais detalhado da hierarquia" (most detailed level of the hierarchy).
  • Cross-filter (single click) and drill-down (double-click) are independent and work at the same time: the cross-filter applies the filter to every other visual on the dashboard; drill-down changes only the clicked visual. When another visual filters the dashboard, the drilled visual stays at the level it was on and is redone with the filter.
  • A single click on the detailed level filters the other visuals by that level's column (for example, municipio = Salvador), without the path taken: a municipality with the same name in another state is also included in the filter.

Drill-through — detail on another page

Drill-down goes inside the visual; drill-through opens another page of the dashboard already filtered by the clicked point — for example, from the SP bar on the summary to the "Detalhe da UF" page, which shows only São Paulo.

Prepare the detail page (edit mode): open the page, leave no visual selected and, on the Propriedades (properties) tab, check Página de detalhamento (drill-through) and drag (or click) into the Drill-through well the columns it can be opened by, such as uf.

Use it: on any visual of another page, right-click a point (bar, slice, table cell, marker...) and choose Detalhar em <page>. The option shows for the pages that accept the point's column; on a drilled visual the column of the level shown is used. The page opens with the value as a page filter, and a trail at the top shows the origin, the value (uf = SP) and buttons to go back to the origin page or see the whole page (✕). Clicking visuals on the detail page filters within the detail, without losing it. Leaving the page (tab, Back) ends the detail.

The server only applies the value on the page marked as target and for the columns it accepts; otherwise the page opens whole and the trail says so.

A ready-made example to explore

The seed-demo-data.sh seed creates the mds-dash-drilldown dashboard with two pre-configured visuals:

  1. Beneficiários por UF (beneficiaries by state) — hierarchy ["uf", "municipio"] over the ds-pessoas dataset.
  2. Gasto por Programa (spending by program) — hierarchy ["programa", "tipo"] over the ds-beneficios dataset.