one way to do that is:
1. Drag Sales to Rows > Convert to Discrete > Multiply it with -1 > Disable Show header > Place it after Year.
Please find attached sample workbook, hope that helps.
Sorting.twbx 1.2 MB
You can solve this by using Rank (Rank Calculation). Just make sure that your table calculation is computed Pane Down!
I created an example using Rank Sum(Sales). Please see the below pic and the attached Tableau Packaged Workbook.
I hope it is answering your question.
Top N with Rank.twbx 510.9 KB
Many thanks for the tip. I have created the measure as indicated by your goodself, however I cannot move the measure. I am attaching the file.
Would appreciate your help.
Perfect - that works! :-) however, it seems that I have a problem in my view. I need to create the top 5 products, somehow its not picking the top 5 in descending order. any help appreciated.
there are various ways to calculated Top N, i used Rank(), please find below steps:
1. Create a flag for Top N customers using RANK()
2. Drag it to Filters:
3. Right click and edit table calculations:
4. Edit filter and select only True Values:
5. You would get result as Top5 by State by Year:
Please find attached sample workbook.
Hope that helps.
question 8.twbx 1.3 MB
The solution you are looking for can be achieved with either a Rank table calculation or a combined field. The benefit of the Rank is that you can give the user the option of top N filtering. This is how you would be taught during an official Tableau course to solve a nested sorting problem.
Andy Kriebel has captured all the necessary steps in a video and provides an example with both techniques in the following link: Tableau Tip Tuesday: Two Techniques for Nested Sorting
Please let me know if I am understanding anything wrongly regarding your question.
I agree with you, i shared using discrete measure tip because TOPN was not mentioned in question (or i misread it ).
however i agree RANK() is better way to calculate TOP N Filtering or TOPN Sorting,