> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a dashboard

> Create a table and bar chart for category sales. Add a region filter and verify that changing it changes both widgets.

TutorialApplies to: Unified engine deployments

Create a table and bar chart for category sales. Add a region filter and verify that changing it changes both widgets.

## Before you start

You need dashboard storage and SQL execution. The SQL includes the same six orders as the first analysis. No catalog is required.

A dashboard **dataset** is the query result used by its widgets. A **widget** displays that result as a table, chart, or other view.

## 1. Create a dataset

1. Open **Dashboards** and create `Lesson - regional sales`.
2. In the editor, select **Add query** and name it `Category sales`.
3. Copy the complete SQL below into the dataset editor.
4. In **Filters**, define `region` as a required, non-null String with default `North`.
5. Preview the query using that default.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
WITH orders(order_id, category, region, amount) AS (
  VALUES
    (1, 'Books',  'North', 20),
    (2, 'Games',  'South', 30),
    (3, 'Games',  'North', 15),
    (4, 'Books',  'North', 40),
    (5, 'Garden', 'South', 25),
    (6, 'Garden', 'North', 10)
)
SELECT category, SUM(amount) AS sales
FROM orders
WHERE region = :region
GROUP BY category
ORDER BY category;
```

`:region` reads the filter value. Do not put quotes around the binding. This SQL needs the dashboard filter definition before it can run. In Workbench, replace `:region` with the literal `'North'` to inspect the same data.

Expect **Books = 60**, **Games = 15**, and **Garden = 10**. Together they total 85.

## 2. Add two widgets

1. Select **Add widget** and choose Table.
2. Select `Category sales` as its dataset and show `category` and `sales`.
3. Add a Bar widget using the same dataset.
4. Use `category` for the category axis and `sales` for the numeric measure.
5. Name the widgets `Sales values` and `Sales by category` and arrange them in the layout.

The SQL already produces one row per category. Compare the table values with the bars before continuing.

## 3. Activate and refresh

1. Select **Save & activate**.
2. Open the dashboard and select **Refresh data**.
3. Wait for the refresh to finish.
4. Check the displayed revision and result time.
5. Verify the three North totals in both widgets.

Activation makes a saved revision available for viewing. Refresh executes its queries. Saving a draft alone does not replace the active revision.

## Change one thing

Change the region filter to `South` and select **Apply filters**. Expect **Games = 30** and **Garden = 25**. There should be no Books row. The total is 55.

An edited filter does not change the result until it is applied. Open **History** and inspect the refresh for South. Switch back to North and apply it to recover the original three rows.

## Check the result

Both widgets use the same dataset and selected region. The visible values match 85 for North and 55 for South. History records the refreshes you used to check them.

## Clean up

This lesson does not need a refresh schedule. Keep the dashboard for practice or delete only `Lesson - regional sales`. If you added a schedule yourself, pause it before cleanup. The inline dataset creates no catalog tables.

## Continue

[Build a notebook](https://docs.e6data.com/transformation/learn/notebook.md) to combine this analysis with written notes. See dashboard filters and refresh and schedules for more options.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.