Top N Slicer
Dynamic Top N Filtering
Build
Overview
Features
Prompts
Troubleshooting
Key Features
Add a RANK-based Top N filter to any chart with a numeric slider slicer, dynamic title, and scoped interactions.
Your bar chart shows every product, country, or customer — but you only care about the top performers. Power BI's built-in Top N filter uses TOPN which breaks with external slicers and doesn't update dynamically. The SQLBI-recommended approach uses RANK with ALLSELECTED to respect all slicer context, but implementing it means building a disconnected table, a RANK measure with the right ALLSELECTED scope, a visual-level filter, a dynamic title measure, a numeric slicer, and interaction restrictions so the slicer only affects the target chart. This skill builds all of it in one command.
How it works
Type /top-n-rank, provide the visual ID, dimension, and ranking measure, and the skill builds everything:
Creates a disconnected TopN table with GENERATESERIES (reuses existing one if present)
Creates a Show/Hide measure using RANK(DENSE, ALLSELECTED) — returns 1 for top N items, 0 otherwise
Creates a dynamic title measure — "Top N {Items} by {Measure}"
Applies a hidden visual-level filter (Show/Hide = 1) on the target chart
Sets the dynamic title on the chart
Adds a "Top" text label and numeric slider slicer above the chart
Restricts slicer interactions so the TopN slicer only filters the target chart
What you get
Disconnected TopN table — GENERATESERIES with configurable range and default N
2 DAX measures —
{Prefix}Show/Hide(RANK filter) and{Prefix}Title Top(dynamic title)Visual-level filter — hidden Advanced filter on
Show/Hide = 1Dynamic title — updates automatically when N changes (e.g., "Top 10 Countries by Sales")
Numeric slider slicer — compact slider with default selection, no header, transparent background
"Top" text label — positioned above the chart, aligned with the slicer
Scoped interactions — slicer only affects the target chart, not other visuals on the page
Why RANK over RANKX
Feature | RANK (used here) | RANKX |
|---|---|---|
Totals behavior | Auto-returns BLANK | Needs ISINSCOPE guard |
Floating-point precision | No issues | Can misrank due to rounding |
Multi-column ordering | Native ORDERBY | Requires nested RANKX |
SQLBI recommendation | Current best practice | Legacy approach |
Why ALLSELECTED over ALL
ALLSELECTED respects all external slicer filters — date, country, segment, and the dimension column itself. ALL would override a slicer on the same dimension, breaking user expectations.
Explore more in this category

Absolute / Percentage Toggle
Build
Add a two-button tile slicer to any chart that switches between absolute values and a percentage variant, with a dynamic format string and auto-derived chart title.

Active Filters Card Visual
Build
Generate a card visual that dynamically displays all currently active slicer and filter selections.

Clone Page
Build
Clone any report page with all visuals, bookmark navigators, interactions, and drillthrough bindings as a fully independent copy.

Convert to Trendline
Build
Add formatted data labels, markers, area shading, and a canvas tooltip to line chart visuals.

