3 Replies Latest reply on Jun 22, 2018 4:20 AM by Mavis Liu

    Top N Customers Problem

    Nirmalraj Alagarsamy

      Hi Team,


      I want to show Top N customers based on Products sold.So I first created Top N parameters and then applied this parameter in the Top tab of Customer ID.(TOP N parameter has been applied on Customer ID column.)


      When I select USA as a country and select top 5 customers,Top 5 customers are displaying Correctly.


      But when I select Canada in the Country filters ,it is showing only one customer even though many customers are available in the Canada.i have attached Canada data  and its customers as a Separated work sheet(I removed Customer Id Dimension from Filter Shelf to show all customers in the Canada) .Not sure why it is showing like this?


      Help me to show Canada top N customers Correctly.Attached dashboard here for your reference.please use the same dashboard for your workouts.

        • 1. Re: Top N Customers Problem
          Naveen B

          If you are using the dimension filter along with top N filter make sure add them to context


          Check the Tableau order of operations , because top N and dimension filter don;t work together.


          Tableau's Order of Operations


          kindly mark this answer as helpful/correct so that it will help others

          • 2. Re: Top N Customers Problem
            Jim Dehner

            Good morning

            please see the attached

            I replaced the top n filter with a rank and rank filter

            the rank is this



            and the filter is this

            set like this


            it will return this for CD


            If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

            • 3. Re: Top N Customers Problem
              Mavis Liu

              Hi Nirmalraj,


              This is because it's finding the overall top 5, and THEN filtering down to the country. So out of the overall top 5, only one of them appeared in Canada's top 5.


              So what you need to do is go to the bar chart sheet and right click on country 1 in the filters and select add to context, your filter should then go grey:






              What putting it into context does is that it pushes up ahead in the order of operations. So first it's filtering on country, THEN finding the top 5.




              I've also replied to your other thread which has the same question.