3 Replies Latest reply on Jul 19, 2017 2:04 PM by Joe Oppelt

    Dynamic Sorting Using Parameters

    CJ Cook

      Hi All,


      I have a table that shows the top 5 posts based on either clicks or engagements via a parameter. The problem I'm having is although it shows the top 5 they are still ordered by the post content instead of the chosen metric. Can someone explain how to resort the the data based on the parameter instead of just filtering? I have also attached a sample workbook to show my problem.


      Thanks in advance and apologies if this has been answered previously.

        • 1. Re: Dynamic Sorting Using Parameters
          Joe Oppelt

          I approached it a simpler way than you were doing.

          See attached.  I put the sort instructions on the [post content] pill on the rows shelf.

          • 2. Re: Dynamic Sorting Using Parameters
            CJ Cook

            This looks like it works now!



            Quick question: Why wasn't I able to sort or filter using my "rank sort variable" within the post content pill? Is it because of the aggregation used in the rank formula?

            • 3. Re: Dynamic Sorting Using Parameters
              Joe Oppelt

              You can.  See attached.  There is a trick to getting an aggregate to sort a sheet.  You have to make it a discrete pill and put it at the front of the list of pills on the shelf.  See what I did with it in the attached.  It will flip back and forth for you between your two measures just like you have it set up.  It's just an added level of complication because it's an aggregate.


              In the attached you can right click on that pill and uncheck "Show Header" so that users don't see the value.  And you can put it on your filter shelf to grab the top 5 just like you previously had it.  (I took it off for now just to display the full effect.)


              BTW, this design trick will only let you sort the aggregate ascending.  So in this sheet it is showing 1-through-N just as it is ranked.  But if for some reason you wanted to show these N-through-1, you would add yet another step.  One more calc, multiply [p. Sort...] by negative 1.  Use that to sort, and your display would show -7 through -1.  It's still ascending, technically, but your calc has reversed the values so your viz comes out descending.