# Answers and dashboards

Ask the agent for any number in your data, and keep the ones you need on a dashboard.


TAGBASE stores each scan together with the data you put on the tag: the
product, the batch, the distributor, or any other field your categories hold.
The [statistics](/docs/dashboard/statistics) pages show the common views of
that data. For a question they leave open, ask the TAGBASE Agent. For an answer
you need again next week, put it on a dashboard.

## Ask the agent

Open the agent with the sparkles button in the top bar and ask the way you
would ask a colleague:

```
How many scans did my product get in the last 30 days?
```

The agent reads your team's scans and alerts. It answers with one number, a
chart, a table of counts, or a list of the latest scans.

| Ask | You get |
|---|---|
| `Scans by country, last 90 days` | A bar chart with one bar per country |
| `Alerts per month, last 6 months` | A line chart with six points |
| `Which weekdays are busiest?` | Scans from Monday to Sunday |
| `Scans by dose` | A chart grouped by a field of your category |
| `Which distributors have the most gray-market alerts?` | Alerts of one rule, grouped by an entity |
| `Show the latest scans from Mexico` | A list of single scans |
| `How many alerts are still open?` | One number |

You can count scans or alerts, and narrow them by status, by country, or by
[alert rule](/docs/dashboard/alerts). You can group them by day, week, month,
weekday, country, product, or status. The fields of your
[categories](/docs/dashboard/categories) and
[entities](/docs/dashboard/entities) work as groups too, so a Distributor
entity gives you scans by distributor and by the distributor's country.

A period is any number of days, weeks, or months up to two years. When you ask
for more than a year by day, the chart shows weeks.

Two habits get you better answers. Name the period, because the agent assumes
the last 30 days when you leave it out. And use the names your categories use:
`Scans by dose` works when a category has a Dose field.

Then refine in the same chat:

```
Group it by week instead
Only invalid scans
Make it the last 6 months
```

### Live and fixed charts

Most answers are live. The chat counts again each time you open it, so a chart
you asked for yesterday shows today's numbers.

Some questions compare numbers that one count cannot hold, such as valid and
invalid scans per country side by side. For those the agent works out the
numbers and draws a chart with fixed values. A fixed chart keeps the numbers
from the moment you asked, and it has a download button for a PNG.

## Keep an answer on a dashboard

Each chart and widget in the chat has a plus button in its top right corner:
**Add to Dashboard**.

[Image: A chart in the agent chat. The plus button in its top right corner is Add to Dashboard. See the web version of this page.]

Press it and the agent lists your dashboards as buttons. The dashboard that
fits the chart best comes first, and **Create New Dashboard** comes last. To
start a dashboard under a name of your own, type the name.

Writing `Put this on a dashboard` does the same.

## Build a dashboard

Your dashboards are under
**[Statistics → Dashboards](/dashboard/statistics/dashboards)**. A dashboard is
a grid of widgets, and each widget shows a number, a chart, a table, a list, or
a map of countries.
Widgets count again each time you open the dashboard.

You can describe a whole dashboard in one message. This one watches for packs
that leave their market:

```
Create a dashboard called Gray Market Watch for my product, last 90 days.
Four numbers on top: scans, invalid scans, gray-market alerts, and
open alerts. Below them, scans per day as a line chart and scans by
dose as a doughnut. At the bottom, gray-market alerts by distributor
and by scan country.
```

The agent shows its plan as a checklist and ticks a step when its widget is on
the dashboard.

[Image: The Gray Market Watch dashboard: four numbers on top, scans per day and scans by dose in the middle, alerts by distributor and by country below. See the web version of this page.]

The gray-market numbers come from an alert rule that fires when someone scans
a pack outside its distributor's country. A widget can count the alerts of one
rule, so [create the rule](/docs/dashboard/alerts) before you ask for the
widget.

## Change a dashboard

Open the dashboard and tell the agent what to change. It knows which dashboard
you are looking at:

```
Make the line chart two thirds wide and put the doughnut next to it
Show scans per day by week
Add a table of scans by product
Remove the open alerts number
```

The agent creates and changes widgets as soon as you ask. It asks first before
it deletes a dashboard or a widget.

To change the layout by hand, choose **Edit Widgets**. Drag a widget to move
it, and drag any of its corners to resize it. You can rename or delete a widget there,
and **Add Widget** puts an empty one into a gap. **Edit Widget** opens the
agent with that widget selected, so you can say what it should show. **Save
Widgets** keeps your changes.

Tables and lists have an **Export** button that downloads their rows as CSV.

AI can be wrong, so check a number before you act on it. The agent needs your
own AI provider connected under
**[Settings → Integrations](/dashboard/settings/integrations)**.

