How to Create a Dynamic Top N Parameter in Tableau
- Aditya Kumbhavdekar

- Apr 14
- 1 min read
Updated: May 28
Ever wished your dashboard users could control how many top items they see?
With a simple parameter and a ranking function, you can give them exactly that flexibility!

Here’s how you do it:
Step 1: Create a Parameter in Tableau
Name it: "Top N Selector"
Data type: Integer
Set a reasonable range (e.g., 5 to 50)
Show parameter control on your dashboard!
Step 2: Create a Rank Calculated Field
RANK(SUM([Sales]))This ranks your dimension based on your measure of choice (Sales, Profit, etc.)
🔹 Step 3: Filter Based on the Parameter
Create a filter calculation:
RANK(SUM([Sales])) <= [Top N Selector]Apply this to your worksheet, and watch your view update dynamically as users adjust the parameter! 🔥
💡 Why this matters?:
Giving users control over the level of detail makes dashboards feel more personalized and interactive. Plus, it’s great for presentations and exploratory analysis!




Comments