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

# `bottom`

## Description

The `bottom` command limits the rows returned from a query to the last *N* rows in a given set, ordered by a specified expression. It is useful for finding the lowest-ranking values or least frequent occurrences within a dataset.

Note

When using this command, pay close attention to your ordering expression, as it determines which records are considered "bottom" in the result.

## Syntax

```
bottom <limit> <result_expression1> [as <alias>] [, <result_expression2> [as

<alias2>], ...] by <orderby_expression> [as <alias>]
```

## Example

**Use case: Get the least active usernames by activity**

We want to identify which users interact with our system the least so we can focus on re-engagement or cleanup efforts.

### Example data

```
{ "user": "Ariel", ... },

{ "user": "Ariel", ... },

{ "user": "Harel", ... },

{ "user": "Harel", ... },

{ "user": "Dana", ... }
```

### Example query

```
bottom 10 user by count()
```

### Example output

```
{ "user": "Dana", "count": 1 },

{ "user": "Harel", "count": 2 },

{ "user": "Ariel", "count": 2 }
```

The command returns the bottom 10 users based on event frequency. In this mock dataset, only three users exist, so all are shown, with "Dana" ranked lowest by activity count.
