6 Replies Latest reply on Nov 2, 2018 9:16 AM by Kay Rohde

    Sort measures or dimensions does not work.

    Kay Rohde

      Hey Guys,

       

      i have been creating some dashboards and i tried to use the function for example: sort ascending or descending, but it doesnt work. I have a sample of data to show what exactly i mean. sort.PNG

      Here it is possible to sort the "Order Date", but not any of the other Measures. The thing is, if i change the place of "Order Date" and "SUM(Profit)" i can sort the Profit.

      My question now can i only sort the first column, if yes that would be very sad.

       

      Maybe there is an other way to sort in Tableau, but i did not found anything.

       

      Thanks very much i attached my woorkbook,

        • 1. Re: Sort measures or dimensions does not work.
          Michael Prokop

          Remove the SUM(Profit), SUM(Revenue) and SUM(Sales) from Rows.  Add Measure Names to Columns and add Measure Values to the Text portion of the Marks instead.  You should then be able to sort on whatever measure you want.

          • 2. Re: Sort measures or dimensions does not work.
            Kay Rohde

            Hey Michael,

            ok wow cool thats works for that, but what if i have not only the Order Date in Rows like at this picture.

             

            sort2.PNG

            Thanks

            • 3. Re: Sort measures or dimensions does not work.
              Michael Prokop

              Right-click on the Name field -> Sort and select to sort Descending (or Ascending, depending on preference) and select the radio button next to Field.  Select the measure you want to sort on. 

               

              The more items you add to the rows shelf adds more to the level of detail, so what Tableau is doing is sorting within that subset of Name and Order Date. 

               

              Hopefully that makes sense. 

              • 4. Re: Sort measures or dimensions does not work.
                Kay Rohde

                I understand what you want to tell me, but an example: maybe one stakeholder wanted to sort the profit and an other want to sort the revenue. If i do it like that the user does not have any option to choose which one he wanted to sort you know what i mean.

                 

                For me it makes no sense if you look for example in a database there you can sort anytime and it does not matter how many measures or dimensions you have.

                • 5. Re: Sort measures or dimensions does not work.
                  Michael Prokop

                  In this case, you may want to use a parameter for sorting, as clicking column headers with more than one item in Rows isn't going to get you what you are expecting.

                   

                  • Create a new parameter and call it "Sort by".
                  • Set the type to be String, pick List as the "Allowable Values" and set the choices to be "Profit", "Revenue" and "Sales", all as their own choice.
                  • Right-click on the newly created parameter and choose "Show Parameter Control"
                  • Create a new calculated field called "Sort Selection"
                  • Put the following in as the calculated field:

                                 CASE [Sort by]

                                 WHEN 'Profit' THEN SUM([Profit])

                                 WHEN 'Revenue' THEN SUM([Revenue])

                                 WHEN 'Sales' THEN SUM([Sales])

                                 END

                  • Right-click on Name in the Rows Shelf -> Sort. 
                  • Set the Field to be Sort Selection
                  • You should be able to control the sort using the parameter dropdown now.
                  1 of 1 people found this helpful
                  • 6. Re: Sort measures or dimensions does not work.
                    Kay Rohde

                    Thats kinda what i wanted to build. It's not the smartest and best looking solution for that, but it works.

                    So thank you very much.