> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Ranking values with Top N fields

> Create a custom field that ranks a text dimension by a measure, keeping only the top or bottom N values.

Top N fields rank the values of a text dimension by a measure and keep only the top (or bottom) N of them, grouping everything else into a remaining bucket. Use them for questions like "what are my 10 best-selling products" or "which 5 regions have the lowest churn."

<Note>
  Top N is a ranking mode of Omni's [Custom Groups](/analyze-explore/custom-fields/bin-group) feature. That page covers how the "remaining values" bucket works in more depth.
</Note>

## Creating a Top N field

Top N is available for **text-type dimensions only**. Numeric dimensions use [Bin](/analyze-explore/custom-fields/bin-group) instead, and timestamp dimensions use [Duration](/analyze-explore/custom-fields#duration-fields).

In the field picker, find the text field you want to rank, select the three-dot menu, and choose **Top N**.

<Frame>
  <img src="https://mintcdn.com/omni-e7402367/UzRGYtLMkykd16Ls/images/top-n-example-1.png?fit=max&auto=format&n=UzRGYtLMkykd16Ls&q=85&s=e499e8f5d72af927ecfa3b74c443ad47" alt="Selecting Top N from a text field's context menu in the field picker" width="2334" height="1604" data-path="images/top-n-example-1.png" />
</Frame>

This opens the same configurator used for Custom Groups, pre-set to **Top N values** mode.

<Frame>
  <img src="https://mintcdn.com/omni-e7402367/UzRGYtLMkykd16Ls/images/top-n-example-2-1.png?fit=max&auto=format&n=UzRGYtLMkykd16Ls&q=85&s=5215e922d41798519ec63a0ab062c4b6" alt="The Top N configurator, showing top/bottom, number of values, and by-measure options" width="776" height="1590" data-path="images/top-n-example-2-1.png" />
</Frame>

Configure:

* **Top or bottom**: rank by the highest values (**Top**) or lowest values (**Bottom**).
* **Number of values**: how many values (N) to keep.
* **By measure**: the single measure to rank by. Top N ranks by exactly one measure at a time.
* **Filters**: optional field-level filters applied before ranking (e.g. only rank based on this year's orders). Period-over-period and "filter by query" aren't supported here.
* **Group remaining values**: on by default — every value outside the top/bottom N is grouped into one row, labeled "Other" (rename it under **Group remaining values as**). Turn this off to exclude those values from the result entirely instead of grouping them.

Once saved, the field behaves like any other dimension — add it to a query, chart it, filter by it, and so on.

<Frame>
  <img src="https://mintcdn.com/omni-e7402367/UzRGYtLMkykd16Ls/images/top-n-example-3.png?fit=max&auto=format&n=UzRGYtLMkykd16Ls&q=85&s=b37818fc737eedd3ca139f10f2db2aa0" alt="A query result showing five ranked cities and an &#x22;Other&#x22; row for everything else" width="1676" height="1108" data-path="images/top-n-example-3.png" />
</Frame>

## Limitations

<Warning>
  If two values tie for the last spot in the ranking, Omni doesn't guarantee which one is included — ties don't have a deterministic secondary sort. If exact tie-breaking matters, add a secondary field to your query to disambiguate.
</Warning>

* Top N ranks by exactly one measure. To rank by a combination of measures, create a custom measure that combines them first, then rank by that.
* A Top N field can't have its own custom sort order, since it's already sorted by its ranking measure. Other fields can still sort by referencing a Top N field.
* Top N fields can't be created from another Top N field.

## Letting viewers change N on a dashboard

Map a [Top N limit control](/visualize-present/dashboards/controls#control-types) to the field so dashboard viewers can adjust N without editing the underlying query.
