This is probably the most effecient way to do it. You could also use either the Rank() or Index() functions and filter -- but that would be a late filter, so all the data has to be returned to Tableau first before the Rank or Index function is applied. It might not be as efficient, but if the number of aggregate rows is small, then it's a viable alternative.
What's the reason you wish to avoid using a context filter?
context filter reduces performance of workbook as it creates a temp table each time the filter changes
how can i achieve that using rank and index function when top 'N' selection is based on a parameter
Context filters used to create temp tables, but I don't think this is any longer true with recent versions of Tableau. Nevertheless, they likely result in rather complex subquerries, which in some cases, may not be performant. You'll have to determine if it is more or less performant than returning all aggregate rows and then applying the Index() or Rank() function.
To do that, you'd create a calculation that compared the Rank to the parameter value, something like:
Rank(SUM([Field])) <= [Top N Parameter]
Place that on Filters, make sure to set the compute using (use the drop down menu on the field on Filters) to compute along all dimensions, and then keep where it is True.
Hope that helps!
Thanks Joshua for your help ,
But the thing is in my filter shelf i have a total of 6 fields out of which 5 are dimensions and one is a measure . so if i add that rank field column to the filter shelf and filter using the measure field filter , would it take the top 'N' values of filtered data?