Top N
Top N keeps only the top or bottom N values of a dimension. Use it when a visual shows more items than a reader needs and only a few of them matter.
Set up a rule
- Open the report in edit mode and select a single visual.
- Open Filters in the side panel and find the Top N section.
- Under Rank by, choose the field whose items you keep. The field is a dimension, not a measure.
- Under Order by, add a field with Add and set it to Highest first or Lowest first. The list offers the visual's measures plus the field you rank by.
- Under Show, pick 5, 10 or 20, or Custom and a number.
- Click Apply. The rule is staged while you edit, like the filters around it, and one Apply commits everything as a single change you can undo in one step. See Filters, slicers and interactions.
While a rule is active, the tile carries a Top {n} badge, and its tooltip shows the ranked field and the order. Clear removes the rule.
The count stays inside the visual's maximum:
- A rule can keep at most 1,000 items.
- A pie or donut stops at 500, and a funnel at 250.
- A number above the maximum is brought down to it when it is confirmed, and a value below 1 becomes 1.
Where a rule can sit
Top N narrows what a visual draws, so it is offered on ranked visuals only; see Visuals for the types.
- It is not offered on a KPI or Cards visual, on a slicer or slicer group, on a custom visual set to the Slicer role, or on a tile on the filter canvas.
- A slicer can never hold a rule: capping its list would hide values a reader picks from.
- Changing the visual type keeps the rule: if the new type cannot rank, the rule stops applying but is kept; switch back and it returns as it was.
How ranking runs
Ranking happens before the visual draws. DataMind groups the data by the ranked field, sorts the groups by your Order by fields, keeps the leading values, and then narrows the visual to those values.
- When Order by holds only the field you rank by, DataMind ranks its values by how many rows each one has.
- A measure worked out over the whole visual ranks nothing: a percent-of-total style measure is calculated across the entire visual, so every value looks the same at ranking time. Order by a plain measure, such as a sum, instead.
- The ranking runs under the same row-level security as the visual, so a rule can only keep values you are allowed to read. See Row-level security and View as.
- A rule whose field left the visual is skipped: ranking only runs when every field the rule points at is still on the visual.
- Blank values are skipped when the rule narrows the visual: the narrowing passes a list of values, and a blank is not one.
What a rule changes about loading
- While a rule is active, the visual loads what the rule keeps instead of its usual page size, and the type's maximum still applies. See Row limits and paging.
- A rule above the maximum runs at the maximum, and the pager keeps working at that size, so items past the first batch stay reachable.
- A bar, combo or line with a Legend field loads in windows; a rule narrows the values it shows and leaves the window as it is.
- While a rule is active on a Map, the map loads by the rule's count, not by a row cap you changed under General > Limits.
Questions, answered
Can I use Top N on a KPI or a slicer?
No. Top N is offered on ranked visuals only. It is not offered on a KPI or Cards visual, on a slicer or slicer group, on a custom visual set to the Slicer role, or on a tile on the filter canvas.
Why can I not order by another column?
Order by offers the visual's measures plus the field you rank by. Ranking groups the data by the ranked field alone, so any other dimension would be dropped when the ranking runs; that is why it is not offered.
Why does my pie or funnel show fewer items than I asked for?
The number is kept inside the visual's maximum: 1,000 in general, 500 for a pie or donut, and 250 for a funnel. A number above the maximum is brought down to it when it is confirmed.
Why does a rule ordered by a percent-of-total measure rank nothing?
A measure worked out across the whole visual, such as a percent-of-total style, looks the same for every value at ranking time, so nothing stands out to rank. Order by a plain measure instead.
What does it rank by when I order by the field I rank by?
DataMind counts how many rows each value of the field has, and ranks by that count.
Does Top N respect row-level security?
Yes. The ranking runs under the same row-level security as the visual, so it can only keep values you are allowed to read. See Row-level security and View as.
Is the rule saved for everyone or only for me?
It is part of the report: it saves with the report and applies to everyone who opens it.
Does a rule work on a chart that loads in windows, like a bar with a legend?
Yes. The rule narrows the values the chart shows, and the chart keeps loading in windows instead of switching to pages. See Row limits and paging.
How do I remove a rule?
With the visual selected, open Filters in the side panel and choose Clear in the Top N section. The badge disappears with the rule.
Why did my Top N stop applying after I changed the visual's type?
A type that cannot rank stops applying the rule, but the rule is kept. Change the visual back to a type that can rank and the rule returns as it was.