> For the complete documentation index, see [llms.txt](https://docs.cascade.io/cascade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cascade.io/cascade/functions-and-expressions/functions/table/lastby.md).

# LASTBY

LASTBY(`column`, `partition column`)

Returns the last element within a column when grouped by unique values within a `partition column`

## Arguments <a href="#arguments" id="arguments"></a>

| Argument           | Description                     |
| ------------------ | ------------------------------- |
| `column`           | Column of any type              |
| `partition column` | Column containing unique values |

## Outputs <a href="#outputs" id="outputs"></a>

Outputs column of values corresponding to the last value within partitioned groups

## Example <a href="#examples" id="examples"></a>

{% embed url="<https://datawrapper.dwcdn.net/hqdRW/1/>" %}
