> ## 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.

# Advanced Query analysis

> Use rolling measures for daily WAU, MAU or moving averages in Kubit Query reports, combine them in formulas, and exclude outliers with measure filters.

Two Query features go past a single measure function: rolling measures, which compute a measure over a trailing window for every day, and measure filters, which drop rows by their measure value. This page covers both, with formulas built from rolling measures.

## When to use

| Use case | Example |
| - | - |
| Weekly or monthly active users, shown per day | Rolling window of 7 days of unique users, for each day |
| A moving average for every day | Rolling 7-day average of a measure |
| Stickiness ratios | Rolling DAU/WAU % or DAU/MAU % |
| Exclude outliers or tiny groups | Keep only breakdown values where `A > 1000` |
| Avoid division by 0 in a ratio breakdown | Filter out groups where the denominator is 0 |

## Rolling measures

A rolling measure computes a measure over the last X days for every day in the date range. It answers questions like "What are my weekly active users on a daily basis?" or "What's the moving average for each day?"

### Rolling options

There are three rolling options. Each one takes a number of days: pick a preset, or type your own.

| Option | What it computes for each day of the date range |
| - | - |
| **Rolling Average** | The average of the measure values for the last X days, including the current day |
| **Rolling Sum** | The measure function applied per day, then the sum of those values for the last X days, including the current day |
| **Rolling Window** | The measure function applied once over the last X days as a single window |

![Measure By dropdown for an Average measure with Rolling selected, showing a Rolling Average option set to 7 days and an Apply button next to the list of measure functions.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/rolling-options.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=fb7a053404515138748ae1c747460de3)

### Build a rolling measure

1. Build your measure in Query.
2. Open the **Measure By** dropdown under the selected event. Click **Rolling** at the top right of the dropdown.
3. Select a rolling option. Select a preset number of days, or enter your own, and confirm it (the screenshot shows an **Apply** button).
4. Click **Execute**.

| Constraint | Value |
| - | - |
| Maximum rolling window | **90** days |

### Compound rolling measures

You can build several rolling measures in one report and combine them in a formula.

| Ratio | Measure A | Measure B | Formula |
| - | - | - | - |
| Rolling DAU/WAU % | Rolling Average, 7 days, of Unique Users | Rolling Window, 7 days, of Unique Users | `A / B` |
| Rolling DAU/MAU % | Rolling Average, 7 days, of Unique Users | Rolling Window, 30 days, of Unique Users | `A / B` |

![Report with Measure A as Unique Users with Rolling Average 7 days and Measure B as Unique Users with Rolling Window 7 days, a formula F1 set to A/B, and the resulting daily ratio plotted as a line.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/compound-rolling.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=c148bc1cccac57b0ce470ef0a56c3f9f)

[Formula](https://learn.kubit.ai/product-analytics/reports/query/formula.md) covers formula syntax and limits.

## Measure filters

A measure filter keeps or drops rows by the value of a measure. Use it to exclude outliers, or to avoid division by 0 when you break down a ratio.

### How it works

In this example, a breakdown by status message has a long tail of small values.

![Data table of event counts by Status Message, with three large values at the top and a long tail of values from 416 down to 0.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/measure-filter-outliers.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=5d2c111da1092ee3ad4d6faab7cd3743)

To focus on the top groups, add a measure filter of `A > 1000`. Under **Report Filter**, click **Add filter** > **Measure Filter**, then enter the condition. The table then keeps only the rows where measure A is over 1000.

![Report Filter with a measure filter A > 1000 and the Add filter menu open showing Global Filter, Cohort Filter and Measure Filter, and a data table that now lists only three status messages.](https://mintcdn.com/kubit/9i8QHxqek50tMBGy/images/reports/query/measure-filter-applied.png?fit=max\&auto=format\&n=9i8QHxqek50tMBGy\&q=85\&s=3077c1dbeac4de073c2800f6cd15bdd4)

## MCP prompt examples

> "Show me a rolling 7-day average of unique users per day for the last 30 days"

> "Create a line chart of daily DAU/WAU: rolling 7-day average of unique users divided by a rolling 7-day window of unique users"

> "Show event counts by status message for the last 7 days, only where the count is over 1000"

## Related

* [Query report](https://learn.kubit.ai/product-analytics/reports/query.md): measures and measure functions.
* [Formula](https://learn.kubit.ai/product-analytics/reports/query/formula.md): combine rolling measures.
* [Filters](https://learn.kubit.ai/product-analytics/reports/common/filters.md): global and cohort filters.


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