4 Replies Latest reply on Aug 21, 2018 5:00 PM by John Liou

    Top 10 Filter in Flow

    John Liou

      Hi Community.


      I am trying to create a top 10 filter in Tableau Prep (not sure if it is possible) because I have thousands (literally) of products under a category and I just want to see the sales $ for the top 10 products.  For example instead of extracting the sales for all products classified under Meat , which could be 1000's of products in the world of supermarket, and then sending this to Tableau Desktop to then create the Top10 list - does anyone know of a way to create the Top10 list within Prep?  I know in Alteryx there is a Rank functionality and then followed by a filter where I can select just the Rank = 1 to 10.  If only I had Alteryx again in my new organisation/role.



      Does anyone have a work around in Prep?




        • 1. Re: Top 10 Filter in Flow
          Ankit Bansal

          Hey John,


          Checkout the link:




          Hope it will solve your issue.



          Ankit Bansal

          • 2. Re: Top 10 Filter in Flow
            John Liou

            Hi Ankit,


            Thanks for the article, the workaround is really helpful and it did work.


            However it falls apart when the dataset becomes too large and often this is the case in my case as the the transactional data are millions x10 per day - or maybe we have an inefficient backend database which unfortunately is beyond my control.  It would be great if Tableau can build a proper Top 10 Filter functionality in the not too distant future.  Perhaps it's already in the pipeline - do you know how I could check what is the functionality nominated by the Tableau Prep community/ users?




            • 3. Re: Top 10 Filter in Flow
              Joshua Milligan



              I'm very hopeful to see this feature in future releases too, because the work-around in the post above does have performance issues for very large data sets and is also a bit limited in the type of ranking it can do. 


              This idea, if implemented, would give a lot of flexibility toward ranking and subsequently filtering: https://community.tableau.com/ideas/8732


              I don't see an idea specifically for a Top N filter, but I'd definitely upvote it.


              You mentioned a backend database.  Another thought would be if you can use Custom SQL to get the top 10 products as part of the source query.  It might be (though there are various ways to write it based on your database) something like:


              SELECT top 10 [Product ID], SUM(Sales) AS [Total Sales]

              FROM Superstore

              GROUP BY [Product ID]

              ORDER BY SUM(Sales) DESC


              you could then inner join that to your product data (either in the flow or in Custom SQL) to limit the source data to only the top 10 products.Hopefully the query would be far more efficient.


              Hope that helps!


              1 of 1 people found this helpful
              • 4. Re: Top 10 Filter in Flow
                John Liou