Tutorial: Building a Dashboard
In this tutorial, you will use the MATIH BI Workbench to create an interactive analytics dashboard. You will add visualizations, arrange them in a grid layout, configure filters, and share the dashboard with your team.
What You Will Learn
- How to create a new dashboard in the BI Workbench
- How to add chart widgets from SQL queries or natural language questions
- How to arrange widgets using the drag-and-drop grid layout
- How to configure dashboard-level filters and date ranges
- How to save, publish, and share dashboards
Prerequisites
| Requirement | How to Verify |
|---|---|
| MATIH platform running | ./scripts/tools/platform-status.sh returns healthy |
| BI service operational | Health check on bi-service passes |
| Query engine operational | Health check on query-engine passes |
| Sample data loaded | The retail analytics dataset is available |
Step 1: Open the BI Workbench
Navigate to the BI Workbench:
- Local development:
http://localhost:3000 - Cloud deployment:
https://bi.{your-tenant}.matih.ai
Log in with your tenant credentials. You will see the dashboard gallery showing any existing dashboards and a Create Dashboard button.
Step 2: Create a New Dashboard
- Click Create Dashboard.
- Enter a name:
Retail Analytics Overview. - Optionally add a description:
Monthly overview of retail performance metrics. - Click Create.
The dashboard editor opens with an empty canvas. The canvas uses a grid layout system powered by react-grid-layout, where widgets can be placed, resized, and rearranged by dragging.
Step 3: Add a KPI Widget
KPI widgets display single metrics prominently.
- Click Add Widget in the toolbar.
- Select KPI Card from the widget type menu.
- Configure the data source:
Query method: SQL
SELECT
SUM(total_amount) AS total_revenue,
COUNT(*) AS total_orders,
AVG(total_amount) AS avg_order_value,
COUNT(DISTINCT customer_id) AS unique_customers
FROM orders
WHERE order_date >= DATE_TRUNC('month', CURRENT_DATE)Or use natural language:
What are the total revenue, order count, average order value,
and unique customers this month?-
Map the result columns:
- Primary value:
total_revenue - Format: Currency ($)
- Label: Total Revenue This Month
- Primary value:
-
Click Add to Dashboard.
The KPI card appears on the canvas. Drag it to the top-left corner and resize it.
Step 4: Add a Line Chart (Revenue Trend)
- Click Add Widget.
- Select Line Chart.
- Enter the query:
SELECT
DATE_TRUNC('day', order_date) AS date,
SUM(total_amount) AS daily_revenue
FROM orders
WHERE order_date >= CURRENT_DATE - INTERVAL '30' DAY
GROUP BY DATE_TRUNC('day', order_date)
ORDER BY date-
Configure the chart:
- X-axis:
date(Date) - Y-axis:
daily_revenue(Currency) - Title: Daily Revenue (Last 30 Days)
- Color: Blue (#2563EB)
- X-axis:
-
Click Add to Dashboard.
Position the line chart below the KPI cards. Drag the resize handle to make it span the full width.
Step 5: Add a Bar Chart (Top Categories)
- Click Add Widget.
- Select Bar Chart.
- Enter the query:
SELECT
p.category,
SUM(o.total_amount) AS revenue,
COUNT(*) AS order_count
FROM orders o
JOIN products p ON o.product_id = p.id
WHERE o.order_date >= DATE_TRUNC('month', CURRENT_DATE)
GROUP BY p.category
ORDER BY revenue DESC
LIMIT 10-
Configure the chart:
- X-axis:
category - Y-axis:
revenue(Currency) - Title: Top 10 Categories by Revenue
- Orientation: Horizontal
- X-axis:
-
Click Add to Dashboard.
Place this chart in the left half of the next row.
Step 6: Add a Pie Chart (Customer Segments)
- Click Add Widget.
- Select Pie Chart.
- Enter the query:
SELECT
c.segment,
COUNT(*) AS customer_count,
SUM(o.total_amount) AS total_spend
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE o.order_date >= DATE_TRUNC('quarter', CURRENT_DATE)
GROUP BY c.segment
ORDER BY total_spend DESC-
Configure the chart:
- Slice:
segment - Value:
total_spend - Title: Revenue by Customer Segment
- Show labels: Yes
- Show percentages: Yes
- Slice:
-
Click Add to Dashboard.
Place this chart in the right half, next to the bar chart.
Step 7: Add a Data Table
- Click Add Widget.
- Select Data Table.
- Enter the query:
SELECT
o.id AS order_id,
c.name AS customer_name,
p.name AS product_name,
o.total_amount,
o.status,
o.order_date
FROM orders o
JOIN customers c ON o.customer_id = c.id
JOIN products p ON o.product_id = p.id
WHERE o.order_date >= CURRENT_DATE - INTERVAL '7' DAY
ORDER BY o.order_date DESC
LIMIT 100-
Configure the table:
- Title: Recent Orders (Last 7 Days)
- Sortable columns: Yes
- Pagination: 20 rows per page
- Column formatting:
total_amount: Currencyorder_date: Date (MMM DD, YYYY)
-
Click Add to Dashboard.
Place the table at the bottom of the dashboard, spanning the full width.
Step 8: Arrange the Dashboard Layout
The dashboard layout is based on a 12-column grid system. Each widget occupies a configurable number of columns and rows.
Recommended Layout
| Widget | Position | Size (cols x rows) |
|---|---|---|
| KPI: Total Revenue | Row 1, Col 1 | 3 x 2 |
| KPI: Total Orders | Row 1, Col 4 | 3 x 2 |
| KPI: Avg Order Value | Row 1, Col 7 | 3 x 2 |
| KPI: Unique Customers | Row 1, Col 10 | 3 x 2 |
| Line Chart: Revenue Trend | Row 3, Col 1 | 12 x 4 |
| Bar Chart: Top Categories | Row 7, Col 1 | 6 x 4 |
| Pie Chart: Segments | Row 7, Col 7 | 6 x 4 |
| Data Table: Recent Orders | Row 11, Col 1 | 12 x 5 |
To rearrange widgets:
- Move: Drag the widget by its title bar.
- Resize: Drag the resize handle in the bottom-right corner.
- Lock position: Click the lock icon to prevent accidental moves.
Step 9: Configure Dashboard Filters
Add interactive filters that apply across all widgets.
-
Click Filters in the toolbar.
-
Click Add Filter.
-
Configure a date range filter:
- Type: Date Range
- Label: Time Period
- Default: Last 30 Days
- Variable name:
date_range
-
Add a category filter:
- Type: Dropdown
- Label: Category
- Source query:
SELECT DISTINCT category FROM products ORDER BY category - Variable name:
category - Allow multiple: Yes
-
Click Apply.
Using Filter Variables in Queries
Update your widget queries to use the filter variables:
SELECT
DATE_TRUNC('day', order_date) AS date,
SUM(total_amount) AS daily_revenue
FROM orders o
JOIN products p ON o.product_id = p.id
WHERE o.order_date BETWEEN :date_range_start AND :date_range_end
AND (:category IS NULL OR p.category IN (:category))
GROUP BY DATE_TRUNC('day', order_date)
ORDER BY dateWhen users change the filter values, all widgets refresh automatically.
Step 10: Configure Auto-Refresh
For dashboards displayed on monitors or shared screens:
- Click Settings (gear icon) in the toolbar.
- Enable Auto-refresh.
- Set the interval:
5 minutes. - Click Save.
The dashboard will automatically re-execute all queries and update the visualizations at the configured interval.
Step 11: Save and Publish
Save as Draft
Click Save to save the dashboard as a draft. Only you can see draft dashboards.
Publish
- Click the dropdown next to Save and select Publish.
- Choose visibility:
- Private: Only you can view
- Team: Members of your team can view
- Tenant: All users in your tenant can view
- Click Publish.
Published dashboards appear in the dashboard gallery for all users with the appropriate visibility.
Step 12: Share the Dashboard
Share Link
Click Share to generate a shareable URL. You can configure:
| Option | Description |
|---|---|
| View-only link | Recipients can view but not edit |
| Edit link | Recipients can modify the dashboard |
| Embed link | An iframe-embeddable URL for external applications |
| Scheduled email | Automated dashboard delivery to email recipients |
Export
| Format | Use Case |
|---|---|
| Printable report | |
| PNG | Image for presentations |
| CSV | Raw data from all widgets |
Visualization Library
The BI Workbench supports these visualization types through its D3.js-based rendering engine:
| Type | Best For | Configuration Options |
|---|---|---|
| Bar Chart | Category comparisons | Horizontal/vertical, grouped/stacked, colors |
| Line Chart | Time series, trends | Multiple series, area fill, markers |
| Pie Chart | Proportions | Donut variant, labels, percentages |
| Scatter Plot | Correlations | Point size, color coding, trendline |
| Heatmap | Two-dimensional distributions | Color scale, cell labels |
| Data Table | Detailed records | Sorting, pagination, column formatting |
| KPI Card | Single metrics | Comparison value, trend indicator, sparkline |
| Gauge | Progress toward target | Min/max, thresholds, color zones |
| Map | Geographic data | Choropleth, point clusters |
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
| Widget shows "No data" | Query returns empty result | Check filters and date ranges |
| Widget shows error | SQL syntax error | Edit the widget and fix the query |
| Chart not rendering | Incompatible data types | Verify X/Y axis column types |
| Slow loading | Complex queries on large datasets | Add indexes, limit date ranges, use aggregations |
| Layout jumps on resize | Grid snap enabled | Adjust grid settings in dashboard settings |
Next Steps
With your first dashboard created, proceed to Training a Model to learn how to use the ML Workbench for machine learning.