2 Replies Latest reply on Jun 6, 2018 8:45 PM by Darshan Dey

    Top 5 Condition in Bar chart

    Darshan Dey



      In the current scenario,  I have used table calculation to calculate shares.


      but when I select top 5 condition in the column shelf(Manufacturer Pill) numbers are getting changed.


      I want to show only top 5 bars in the chart with the same numbers.


      Please let me know your thoughts regarding the same.


        • 1. Re: Top 5 Condition in Bar chart
          Steve Martin

          Hi Darshan,


          Use an Index() Filter


          So, you can use a parameter here if you want or hard-code to 5. I will demonstrate with a top n filter


          Create a parameter [Top N Select]: As a range filter with the values set from 1-10


          Next the filter [Top N]:


          Index() < [Top N Select]+1


          Place the [Top N] filter onto the filters and select 'True'


          In my example, I have two charts, the left, does not filter but instead alters the colour according to the top n, this is to support the chart on the right, which does filter as requested, so you can see the filtering and compare back


          This method assumes you are using a sorted set as shown in your screen-shot.


          I have also included a method for an un-sorted set which can also apply to a set that is sorted differently; this uses a rank instead of an index, again, this is a table_calc:


          Rank(Sum(Sales),'Desc') < [Top N Select]+1


          These methods are also compatible with partitioning however, you do need to be mindful of the scope - ask if you need a hand with this.



          1 of 1 people found this helpful
          • 2. Re: Top 5 Condition in Bar chart
            Darshan Dey

            Hi Steve,


            Thank you for the solution,


            It really helped me alot.