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

# Query report

> Build a Query report in Kubit: pick events, choose a measure function and answer how-many questions about your users, traces or events.

A Query report answers "how many" questions about your events. This page covers building measures (events and measure functions), prompting Kubit through the MCP server, and where to find the Query reference pages for chart types, filters, formulas, grouping, comparison, chart settings and the data table.

## When to use

| Use case | Example |
| - | - |
| Count activity in a time window | How many users performed an event in the last 7 days |
| Measure a share of a group | The percentage of paying users who performed a critical event last month |
| Track an active-user metric | Monthly active users for the past 6 months |
| Average a count over a period | How many users, on average, performed any event per day over the past 7 days |

![Report builder with Chart Type set to KPI and three measures, showing KPI cards for Total Traces, Events, Tokens Used and Total Cost above a data table that compares each measure with the previous week.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/query-overview.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=690a2d8b39b897af5ab657764c4d4073)

## Build your measures

A measure has three parts: the event to analyze, the function to compute, and any filters to apply.

### Event

Select the events to analyze from the event dropdown in the measure. Selecting several events in one measure uses OR logic: a member of the measure performed Event 1 or Event 2.

To apply different filters to different events, add another event group to the same measure. Open the event group's options menu (the three-dot icon) and click **Add Event**, which adds events to the measure with OR logic. **Duplicate Event** copies the group.

![Measure A with two event groups joined by OR, the first with Add to Cart and Check Inventory and the second with Place Order, and an options menu open with Add Event and Duplicate Event.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/query-event-groups.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=4c3121b938266fe0a1c0acff17d92e0f)

### Measure functions

The measure function sets what Kubit computes for the selected events.

| Function | Description | Field required? |
| - | - | - |
| **Count** | Count of all events | No |
| **Count Distinct** | Count of unique values of a field | **Yes** |
| **Sum** | Sum of a numeric field's values | **Yes** |
| **Avg** | Average of a numeric field's values | **Yes** |
| **Min** | Minimum value of a field | **Yes** |
| **Max** | Maximum value of a field | **Yes** |
| **Percentile** | Nth percentile of a field's values | **Yes**, plus the percentile value, such as P95 |

![Measure By dropdown open under Measure A, listing Count Events, Unique Users, Unique Sessions, Unique Traces, Unique Spans and Unique Values, with a Rolling option at the top.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/query-measure-functions.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=def5b3562ba5b694ba851c6992621e31)

[Advanced Query analysis](https://learn.kubit.ai/product-analytics/reports/query/advanced-analysis.md) covers rolling measures and measure filters.

## Prompt Kubit through MCP

With the Kubit MCP server connected to Claude, ChatGPT or another AI tool, you create Query reports by describing them in plain language. The MCP server turns the request into a chart configuration.

### What a good prompt includes

| Part | What to say |
| - | - |
| **Chart type** | The visualization you want |
| **Measure** | What to calculate (count, sum, average) and on which field |
| **Date range** | The time window |
| **Breakdown** | How to segment the data, if needed |
| **Filters** | Conditions that narrow the data, if needed |

### MCP prompt examples

Simple, with one measure and no breakdown:

> "Show me a KPI of total events this week"

Medium, with a measure, a breakdown and a time range:

> "Create a bar chart of daily count distinct users over the last 14 days, broken down by country"

Advanced, with several measures, a filter and a comparison:

> "Build a combo chart showing weekly total revenue as bars and average order value as a line for the last 3 months, filtered to premium users, compared to the previous 3 months"

Chart-specific parameters:

> "Create a heatmap of average response time with model name on the X-axis and tool name on the Y-axis for the last 7 days"

### How Kubit reads a prompt

| You write | Kubit does |
| - | - |
| No schema | Infers the schema from your workspace context |
| What you want to learn, without a chart type | Picks a chart type for you |
| An Impact chart request | Needs the trigger event spelled out, for example "after users click checkout" or "when the deploy event fires" |
| "by country", "by browser" | Adds a breakdown on that dimension |
| "only premium users", "where status is error", "excluding test accounts" | Adds a filter |

## Query reference

| Topic | Page |
| - | - |
| Every chart type and its required parameters | [Chart types](https://learn.kubit.ai/product-analytics/reports/query/chart-types.md) |
| Filter conditions and operators | [Filters](https://learn.kubit.ai/product-analytics/reports/common/filters.md) |
| Calculated metrics from several measures | [Formula](https://learn.kubit.ai/product-analytics/reports/query/formula.md) |
| Breakdowns and value buckets | [Group by and binning](https://learn.kubit.ai/product-analytics/reports/common/group-by-and-binning.md) |
| Comparing against a prior period | [Compare](https://learn.kubit.ai/product-analytics/reports/common/compare.md) |
| Axis, number format, reference lines and sorting | [Chart settings and formatting](https://learn.kubit.ai/product-analytics/reports/query/chart-settings.md) |
| The data table, hiding series and CSV export | [Data table view](https://learn.kubit.ai/product-analytics/reports/query/data-table-view.md) |
| Rolling measures and measure filters | [Advanced Query analysis](https://learn.kubit.ai/product-analytics/reports/query/advanced-analysis.md) |

## Related

* [Reports overview](https://learn.kubit.ai/product-analytics/reports/overview.md): the other report types.
* [Dashboards](https://learn.kubit.ai/product-analytics/dashboards.md): put a Query report on a dashboard.


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