top of page

How to Create a Dynamic Top N Parameter in Tableau

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!



Dynamic Top N Parameter in Tableau
Follow these steps to create a parameter in Tableau

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


bottom of page