5. Build a dashboard

A useful CRM dashboard answers four questions on one screen: how many leads landed, how fast they convert, where the pipeline is concentrated, and what is closing this quarter.

Estimated time: 25 minutes.

5.1 Layout

Create a new dashboard crm-overview with a 12-column grid:

RowWidgetWidth
1KPI: Leads this week3
1KPI: Conversion rate (qualified / total)3
1KPI: Open pipeline value3
1KPI: Closing this quarter3
2Bar chart: leads by source6
2Funnel: opportunities by stage6
3Line chart: weekly created vs qualified leads12
4Table: top 10 opportunities by amount12

Sales dashboard with KPIs, charts, and drill-down

You start from the dashboards list page and click New dashboard to enter the editor — a grid canvas where each cell is a widget bound to a saved query.

Dashboards list

Dashboard editor — grid canvas + widget property panel

5.2 Define the queries

Use the Query Builder to define each widget's data source. The Query Builder is a visual SQL composer: pick a source model, add measures and dimensions, configure filters — then save the query as a reusable widget data source.

Query Builder — visual measure / dimension / filter composer

Example for the leads-by-source chart:

query:
  source: crm_lead
  groupBy: source
  measures:
    - { kind: count, alias: leads }
  filters:
    - field: created_at
      op: gte
      value: ${range.start}
    - field: created_at
      op: lte
      value: ${range.end}

${range.start} and ${range.end} come from the dashboard-level date range filter.

5.3 Drill-down

Configure the funnel widget so clicking a bar navigates to /docs/...?stage=<x> — i.e. opens the Opportunity list page filtered by stage. This is one option per widget:

"onClick": {
  "kind": "navigate",
  "to": "page:crm_opportunity_list",
  "params": { "stage": "${bar.key}" }
}

5.4 Verify

  • All KPIs match a manual SQL count
  • Date-range filter recomputes every widget
  • Clicking a funnel bar lands on the filtered list page
  • The dashboard renders in < 1 second on local data (~10k rows)

Next

Chapter 6 → Ship to mobile