6 Replies Latest reply on Jan 12, 2017 12:01 PM by Kelly Pearce

    Why can't I sort on a Measure or Dimension?

    Richard Burrell

      The Measure is the pill in Marks. We've moved it all around, no joy. You'll see the value of 450 in the right column. It's surrounded by 1s. And no sorting works. We tried changing the field data type, no joy.

       

      We've tried making it Discrete/Continuous. We think it's more of the limitations from PostgresSQL or some underlying data structure.

       

      Honestly, trying to sort on a number field shouldn't be this hard. So any help or suggestions would be welcome. Seems like we overlooked something pretty simple to sort the number column in ASC or DESC.

        • 1. Re: Why can't I sort on a Measure or Dimension?
          Patrick A Van Der Hyde

          Hello Richard Burrell

           

          In this case the field [#] is not aggregate.  I am presuming this is on purpose and you are trying to sort row level data.

           

          However the sort options are at the Aggregate level (sum)  so you can only sort at the lowest level.  See my attached example.  The scenerio you show is in "Sheet 1".

           

          See Ascending and Descending for methods to work around this.  by utilizing a Discrete copy of the Shipping Cost field on the Rows shelf, we can control the sort order.  The field can be hidden (as I have done) by de-selecting "Show Headers" from the drop down menu of the field on the Rows shelf.

           

          I hope this helps.

           

          Patrick

          1 of 1 people found this helpful
          • 2. Re: Why can't I sort on a Measure or Dimension?
            Richard Burrell

            Okay, I follow your approach.

             

            How would you publish this workbook to Tableau Server and allow the User to sort on that field?

             

            Or, would you just publish these versions and have them just go to that tab to see them sorted in ASC or DESC?

            • 3. Re: Why can't I sort on a Measure or Dimension?
              Patrick A Van Der Hyde

              Hello Richard Burrell

               

              Thank you for the response.

               

              You could utilize a parameter to control the view in a manner desired as described here: http://kb.tableausoftware.com/articles/knowledgebase/parameterized-measure?lang=en-us

               

              I have attached an updated workbook as an example.  I also should go back and make it clear that what Tableau is doing is sorting the Dimensions in the order that they are placed on the Rows shelf.  The order of Dimensions creates a  hierarchy and the sort of a dimension is only applicable within the lowest level of the hierarchy.  By placing the measure to the furthest left row and setting it to discrete, we are creating a sort of the view at the lowest Dimension.  The Selected Measure field could be put at a different level of the view such as  between Country and Postal Code and this will allow the sorting of the rows by Country as I have provided in another example view.  The example views are probably the best way to make this clear. 

               

              I hope this helps.

               

              Patrick

              1 of 1 people found this helpful
              • 4. Re: Why can't I sort on a Measure or Dimension?
                Stephen Kirschenmann

                As best as I can tell from the original post, this doesn't solve the problem.  I'm experiencing the same issue.

                 

                Using the original screen shot attached, I want to be able to sort by the column without a header.  The attached workbook from Patrick seems to just use a parameter to swap out calculations/measurements.

                 

                Here's a screen shot of my issue.  I want to be able to sort by RetailerID_Countd, which is given a blank column heading.

                Capture.JPG

                 

                Any help?

                • 5. Re: Why can't I sort on a Measure or Dimension?
                  chris.jeanty

                  Hi  Stephen,

                   

                  Please refer to my discussion thread. The solution is indeed here, however the responder didn't really explain why his parameter based pill worked as a sorter.  I highlighted that "why" in my discussion thread.

                   

                  Hope it helps!

                  • 6. Re: Why can't I sort on a Measure or Dimension?
                    Kelly Pearce

                    I know this is an old post, but hopefully this helps others searching for a quick solution to this problem without having to create a parameter or other scenario. Since Tableau sorts on the first dimension or measure placed on the rows shelf then you can create a copy of that dimension or measure by right clicking on it and select duplicate. Place this new dimension or measure in the first position on the rows shelf. Right click the pill and select sort. Choose which method of sorting you would like, sort order, sort by or manual sort. Select OK. Right click the first pill again (the copy) and select Show Header to deselect the header option (you're hiding the header). This forces the sort of both the dimensions or measures (the copy and the original) and hides the data in the copy.

                    3 of 3 people found this helpful