# NQL summarize

The `summarize` statement condenses the information into a single result.

### Syntax <a href="#nqlsummarize-syntax" id="nqlsummarize-syntax"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
...
| summarize <new metric name> = <metric>.<aggregation function>
```

{% endcode %}

### Examples <a href="#nqlsummarize-examples" id="nqlsummarize-examples"></a>

Compute the average value of the number of page views per device.

{% code overflow="wrap" lineNumbers="true" %}

```
devices
| with web.page_views from Jun 1 to Jun 7
| compute num_navigations = number_of_page_views.sum()
| summarize average_num_navigation_per_device = num_navigations.avg()
```

{% endcode %}

| average\_num\_navigation\_per\_device |
| ------------------------------------- |
| 115.9                                 |

Count the number of devices active in the last 7 days. In case of the `count()` aggregation function, you can omit the filed name before the aggregation to count the number of records of the root table.

{% code overflow="wrap" lineNumbers="true" %}

```
devices during past 7d
| summarize number_of_devices = count()
```

{% endcode %}

| number\_of\_devices |
| ------------------- |
| 285                 |

Compute the total size of all the binaries.

{% code overflow="wrap" lineNumbers="true" %}

```
binaries during past 7d
| summarize total_size = size.sum()
```

{% endcode %}

| total\_size |
| ----------- |
| 611.3 GB    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-keywords/nql-summarize.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
