7 Replies Latest reply on Jun 13, 2018 2:43 AM by Pratik Pushp

    Sorting of positive and negative values

    Pratik Pushp

      Hi All,

       

      I've a column which consists of both positive and negative values. When I'm trying to apply sorting, the positive values are only getting sorted and the negative values are listed at the end. Could you please suggest/advice if sorting of both the values(+ve, -ve) are possible at a time?

        • 1. Re: Sorting of positive and negative values
          Mavis Liu

          Hi Pratik,

           

          Sorry I'm not quite understanding what you mean. Isn't that the expected outcome? To have the positives at the top and negatives at the bottom if the values are sorted in a descending order?

           

          Did you want it to be sorted on absolute values? In which case make the calculated field abs(value) then apply the sort based on this absolute field:

           

          2018-06-12_13h48_39.png

           

          2018-06-12_13h48_55.png

           

          So then we get this result:

          2018-06-12_13h49_14.png

           

           

           

          Thanks,

           

          Mavis

          • 2. Re: Sorting of positive and negative values
            sudheer.kumar.5

            Hello Pratik,

             

            Not sure what is the expected result. How are you sorting the data? What are the actual result and expected result?

             

            This is what Tableau is giving if we sort descending order:

             

             

            S

            • 3. Re: Sorting of positive and negative values
              Pratik Pushp

              Hi Mavis and Sudheer,

               

              Please see the below. The PC Delivery Deviation field is sorted in ascending order. So, the negative values should be on the top.

               

              Actually, the sorting is working fine if we sort by specific field instead of Data Source Order but I have multiple fields(Text and numbers) on the sheet and sorting should work for each field. So, I've created a set of parameters which contains all the fields present on the sheet and then one calculated field in which I'm assigning the specific field by which I want to sort from the parameter. Then, I am putting the calculated field as the first column and hiding the label. This way I'm able to sort by each field but it's not working for negative values. Hope you understand the issue.

              • 4. Re: Sorting of positive and negative values
                Mavis Liu

                Hi Pratik,

                 

                In that view, you need to actually sort Created/Re-Open Date by in an Ascending order by the PC Delivery field.

                 

                Thanks,

                 

                Mavis

                • 5. Re: Sorting of positive and negative values
                  Pratik Pushp

                  Hi Mavis,

                   

                  Thanks for the response. I think there's some confusion. Please see below, If I'm changing the sort by from Data source order to specific field it's working fine but as I said I've multiple fields on the sheet and need to implement sorting for each field.

                   

                  • 6. Re: Sorting of positive and negative values
                    Mavis Liu

                    Hi Pratik,

                     

                    From your screenshot, it looks as if you're sorting on a different field?

                     

                    You're sorting the field Sort_PC_Delivered Precision, but you want the numbers to be in ascending order, therefore you MUST use sort by specific field.

                     

                    If you're sorting by Field Sort_PC_Delivered Precision data source order, you're sorting purely on this field. If this field is a string, then it's sorting based on alpha numeric order.

                     

                    I'm not sure what type field your Sort_PC_Delivered Precision is, but sorting based on data source would be the problem and won't give you the sort you want. It's isolated from the PC Delivery Deviation at this point, so you have to TELL it to sort based on that field.

                     

                    Does that make sense?

                     

                    Thanks,

                     

                    Mavis

                    • 7. Re: Sorting of positive and negative values
                      Pratik Pushp

                      Hi Mavis,

                       

                      Apologies for the confusion, I could have explained bit more. Sort_PC_Delivered Precision is a calculated field of type String. To implement the sorting on multiple columns, I've created this field and assigning the specific fields here via Parameters(see at right). Have kept this calculated field as first place in the Rows and assigning the field  by which I want to sort. By this way I am able to achieve sorting by any field present on the worksheet.

                       

                      Have used ideas from this particular thread Sorting is not working