Looking at that quickly, I can't see why it's doing this. Your top 15 from the database are all in Manhattan, but it should be grabbing the top 15 of whatever is filtered onto the sheet.
You have INDEX as a calc. Use that. Make a calc that says
IF [index] <= [Top Stations] then 1 END
Put that on filters and select for value = 1. (Take off your Top-N from [Start Station] too.)
I took a different approach, I hope that will answer your need. I will attach the edited workbook.
I made a copy of your calculated field RANK in case I had to edit it to avoid messing things. I added a calculated "In top ?" field ([RANK cnt tripduration]<=[Top Stations]).
I just added the rank in the sheet and the "In top ?" filed in the filter, removed your table calculations and that worked when filtering on a borough.
It does not work though when filtering on neighborhood. When filtering out a neighborhood, it removes the lines of this neighborhood but does not recaculate the rank.
I could not change the table calc to take this into account. I think this is due in some way to the fact that these fileds are in the secondary datasource.
So I started the sheet with the "city bike boroughs" datasource.
I huste added the filters, then used "201607-citibike-tripdata" as a secondary datasource and I can now have the top N whatever the filters used.
I hope this will help you.
Tableau example help_V2.twbx 39.9 MB