Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Fcommands-reference%2Fcount.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Fcommands-reference%2Fcount.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `count`

## Description

The `count` command returns a single row representing the total number of documents in the current result set. It can optionally store this result in a named keypath for readability using the `into` keyword.

## Syntax

```
count [into <keypath>]
```

## Example

**Use case: Count the number of HTTP request logs**

We have log entries representing HTTP requests, each with a `status_code` field. Using `count`, we can determine the total number of requests that include a status code, optionally saving the result under a custom name for clarity.

### Example data

```
{ "status_code": 200, "path": "/home" },

{ "status_code": 404, "path": "/not-found" },

{ "status_code": 500, "path": "/checkout" }
```

### Example query

```
filter status_code != null

| count into http_request_count
```

### Example output

| http*request*count |
| ------------------ |
| 3                  |

The `count` command aggregates the number of documents that meet the filter condition and returns the total as a single record. In this case, all three documents contained a `status_code`.
