1 Reply Latest reply on Sep 14, 2016 9:32 PM by Kathryn Bridges

    How to sort bar chart with measure values having measures

    Anu Rekha

      Hello All

       

      Greetings!

       

      Could you please let me know if we can get the sort pill on a barchart, where bar consists of multiple measures

       

      In the link below, I can sort using the second bar i.e quantity,

      Tableau Public

       

      but for the first one(Measure Value)) I am not getting sort pill , would be really good if I can sort by the total value(,i.e the full bar measure value).

       

      Thanks Anu

        • 1. Re: How to sort bar chart with measure values having measures
          Kathryn Bridges

          Hi Anu,

           

          The issue with sorting "Measure Values" in a combined chart is that it's not clear what variable it would actually sort by if you had the option. Since you can choose up to 6 variables, Tableau doesn't know which one you actually want to sort by.

           

          One way to get around this is to create a parameter with all of your Measure Values. Then, create a Calculation with that Parameter something like

          "if [Sort By:]="Avg. Discount"

          then avg([Discount])

          elseif [Sort By:]="Avg. Sales"

          then avg([Sales])

          elseif [Sort By:]="Discount" then

          sum([Discount])

          ELSEIF [Sort By:]="Number of Records"

          then sum([Number of Records])

          ELSEIF [Sort By:]="Profit"

          then sum([Profit])

          ELSEIF [Sort By:]="Quantity"

          then sum([Quantity])

          ELSEIF [Sort By:]="Sales"

          then sum([Sales])

          end"

           

          Now, if you drag this next to Sub-Category and hide the label, you can allow the user to select what Measure they want to filter by with a parameter.

           

           

          Workbook is attached as well. Hope this helps!