---
source_url: https://www.pubnub.com/docs/analytics/decisions/create-advanced-query
title: Create an advanced query
updated_at: 2026-09-30T07:20:08.000Z
---

# Create an advanced query

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

This guide shows you how to create an advanced Query Builder query from scratch, shape the results using query operations, and save the query.

:::tip Preview
Query Builder is in preview. Features and functionality may change.
:::

## Before you start

Before starting, confirm you have:

* Access to Illuminate in the [Admin Portal](https://admin.pubnub.com/).
* At least one [Business Object](https://www.pubnub.com/docs/analytics/decisions/business-objects.md). An active Business Object shows data immediately. An inactive one shows no data until activated.

For an overview of advanced queries, query operations, and how queries connect to Decisions, see [Query Builder](https://www.pubnub.com/docs/analytics/decisions/query-builder.md).

## Configure the query

1. In the [Admin Portal](https://admin.pubnub.com/), go to **Illuminate > Business Objects**.
2. At the top of the Business Objects page, click **New query**, then click **Create advanced query**.
3. Enter a name for your query. Add an optional description.
4. Click **Select Business Object** and choose a Business Object from the list. If the Business Object is not yet activated, the query returns no data.
5. Set the default limits:

   * **Period**: how far back in time the query looks at data from the Business Object. An advanced Query Builder query looks back 1 hour by default, up to a maximum of 1 day.
     * **Maximum rows**: the maximum number of rows the query returns. An advanced Query Builder query returns at most 500 rows.

6. Optionally, click **Run** to preview the raw data before adding operations.

## Add query operations

Operations shape and refine the data the query returns. You can chain multiple operations.

1. Click **Add to query**.
2. Select an operation from the list.
3. Configure the operation using the options that appear.
4. Repeat to add more operations.

Available operations:

| Operation | What it does |
| --- | --- |
| Aggregation | Calculates a summary value: average, count, count distinct, sum, min, or max |
| Filter | Narrows results to rows that match specific criteria |
| Group By | Groups rows sharing the same field value so aggregations apply per group |
| Sort By | Orders results by a chosen field in ascending or descending order |
| Selection | Returns only specified fields instead of all available fields |

## Save the query

1. Click **Save** to store your query configuration.

After saving, you can click **Run** to execute the query and review results. Each row represents a condition that can trigger an action when you connect the query to a Decision. See [Create a Decision from a query](https://www.pubnub.com/docs/analytics/decisions/create-decision-from-query.md).

Last updated at: 2026-09-30T07:20:08.000Z
