# AI in analytics

> Ask for the cut you want in words and get the widget itself - over your data, inside your access rights, and shown to you before it is saved

Source: https://aipril.dev/docs/analytics/ai

## What it does for you

**A chart from a prompt.** "Revenue by region for the quarter against last year" comes back as
numbers over your own data and a picture you can keep, not advice on how to build it. If it is
right, you save it onto a dashboard. If it is not, you sharpen the question and it comes back
rebuilt.

**A whole dashboard in dialogue.** The headline number first, then the cut the conversation asked
for, then a table of the exceptions. A few exchanges later the screen holds what would normally
have taken a ticket and a week.

**The dull half of preparation.** Have it write the formula for a calculated column, normalise
values that arrived in three different spellings, apply the conditional formatting rule that marks
what is out of range, or set the filters you just described in words.

**A model over a table you have only just uploaded** - described in words instead of assembled
field by field, so the first chart does not wait for the modelling.

**A chart type that does not exist yet.** Describe the shape you want and have the definition
written for you, instead of writing it by hand or waiting for it to appear in a release.

**Answers to the follow-up questions** in the same conversation, not on the next trip through
somebody's queue. This is where most of the time goes in practice: the first number is
rarely the one people needed.

## Why it is not guessing

Most assistants meet your data cold: they are shown a schema and a few rows at the moment you ask,
and everything else - what this table is for, what the column with the cryptic name means, which
cut of it is the one people actually take - the model infers on the spot. That is where confident
wrong answers come from.

Here a scan studies the dataset before anyone asks it anything. It reads the data and writes down
what it found:

- **What this data is** - the domain it belongs to, a plain summary, the questions it is normally
  asked, and the gotchas somebody would otherwise learn the hard way
- **What the columns mean** - business labels for names that were never meant to be read by people
- **Query patterns** - the shapes of question this data actually answers, recorded once instead of
  rediscovered per conversation
- **Business rules** - what holds true in it: what is netted off, what is excluded, what a status
  really means
- **Suggestions for the semantic layer** - metrics and dimensions worth defining once for everyone

When you then ask a question, the relevant pieces are retrieved and put in front of the model
instead of being invented. Retrieval is hybrid on purpose: meaning-based search, exact wording and
near-miss matching all contribute, so a question asked in your company's own vocabulary still finds
the pattern that fits it. Each scan also reads what earlier scans learned, so the knowledge
accumulates instead of being rebuilt from nothing every time.

**And it is yours to manage.** Scan results are visible on the dataset itself - you can read what
the scan concluded, and re-run it when the data or its meaning has moved on. Each run is a recorded
job with its progress and its outcome, so a dataset that failed to scan says so instead of quietly
degrading the answers. The semantic-layer additions arrive as suggestions to accept, not as silent
edits to the definitions everyone else depends on.

## What keeps it honest

> An assistant that produces a confident wrong number is worse than no assistant at all. That is
> the failure this mode is designed against, and everything below exists to make that failure noisy
> instead of silent.

- **It works on your data and inside your access.** The request stands behind you: what you may not
  see, it may not show you. The assistant's own permissions are set deliberately, not inherited
  from yours.
- **It uses the company's definitions.** Revenue is calculated the way the
  [semantic layer](https://aipril.dev/docs/engine/data-model.md) records it, not the way the conversation understood
  it.
- **You see it before it is saved.** An applied chart arrives as an unsaved panel; saving is the
  ordinary action you would take anyway. Nothing is written on your behalf as a side effect of
  asking.
- **A deterministic check stands between the model and the chart.** A metric put where a dimension
  belongs, or a column that does not exist, is rejected with a precise, correctable error. Nothing
  quietly repairs a role: a silently "fixed" chart is how a plausible wrong number reaches a
  meeting.
- **It asks instead of guessing.** Where a column is ambiguous, a clarifying question comes first,
  and your confirmed choice overrides what the model proposed.
- **What it produces is not a lookalike.** The assistant draws nothing itself: it tells the screen
  what to show, and the same program that works under your mouse does the drawing and the counting.
  A generated chart and a hand-built one are the same object, so anything you can do to one you can
  do to the other.

## Next

[Under the hood](https://aipril.dev/docs/analytics/under-the-hood.md) - the query path, the two execution modes, and
where access control is applied.

## Related

- [Data model](https://aipril.dev/docs/engine/data-model.md) - the definitions an answer is computed from.
- [Built with AI](https://aipril.dev/docs/engine/ai.md) - the same assistant on the modelling side.
- [Inside the work](https://aipril.dev/docs/analytics/inside-the-work.md) - where the answer is meant to land.
- [AI harness](https://aipril.dev/docs/harness/agents.md) - what the assistant is, underneath.
