2 Replies Latest reply on May 17, 2017 5:34 AM by Ivan Monnier

    Top N type in not working properly with multiple filters

    Brook Bisrat

      Hi there,

       

      I am trying to figure out to properly get the N filter to work in this dashboard. As you can see the dashboard works for Top N (top stations), for the day of the week, time of day, gender, but not for the borough. For example, if you were to choose Brooklyn for the borough, and entered in 10 for the top stations. The data would be null (show nothing). I can't figure out how to get this to work? I tried using lookup, index, and rank - but maybe I wasn't using it correctly.... Finding the Top N Within a Category | Tableau Software

       

      If anyone could help, I would really appreciate. A sample workbook is attached.

       

      Thanks,

      Brook

        • 1. Re: Top N type in not working properly with multiple filters
          Joe Oppelt

          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.)

          • 2. Re: Top N type in not working properly with multiple filters
            Ivan Monnier

            Hello,

             

            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.

             

            Best regards

             

            Ivan Monnier