Instead of filtering on state, I recommend you to use INDEX as a filter. TOTAL() is a table calculation, and it is a very powerful feature of Tableau. The reason why it is called table calcs is because the calculations are done based on the view. When you filter on state, the view changes. As a result, your table calc will break.
To filter, follow these steps
1. put a discrete INDEX on rows, in front of state
2. put a continuous INDEX on filters card, show quick filter and
3. select "range of values" as filter type
now you can filter down to top 5 without breaking the calculation.
Top N.twbx.zip 333.1 KB
Thank you very much! Yes, it works!
I have a second question: In the attached workbook based on yours, I tried to create a monthly margin stats for top 5 states in 2011. The INDEX() and % of total all seem work all right. But is there a way to remove the partition line between 2010 and 2011 panes so it will connect continuously? Appreciate your time!
Hi Li / Jazmyn,
Did you figure out how to plot Top N on a line graph without impacting the percentage values ? Attaching the work book. Appreciate your help.