6 Replies Latest reply on Mar 4, 2014 8:04 AM by Hope Barrett

    How can I sort a bar graph created using Index()?

    Hope Barrett

      Hello,

       

      I have a list of text data where I need to group it by frequency and then separate the list into bins. Essentially, I want to identify the term that appears the most, the terms that appear 2 - 3 times, and the terms that appear more than 3 times. I accomplished the first part of my task by counting the list of terms and sorting it in descending order. I used the Index() function to rank the terms and then created bins using my Index() function. This appears to work and I have my terms in three groups.

       

      My challenge is that I would like to sort the results so that the "1" bin is on the bottom of the bar graph and the "3" bin is on the top of the bar graph. Currently, my bar graph is sorted in the reverse order of what I want. How can I change the sort of the stacked bar graph? I attempted to use How to sort individual Stacked Bar chart? to change my sort, but I wasn't able to place anything on the filter that changed the sort. A packaged workbook with mock data is attached. Thanks for your help!

       

      Cheers!

       

        • 1. Re: How can I sort a bar graph created using Index()?
          Matt Lutton

          Sort Stacked Bar.png

          Hey there Hope--interesting problem and solution at the link provided.  I was able to get that solution to work by defining a Custom date on Date (Months), then using a Combined field on the [Date (months)] and [Field] fields, placing that on the Detail shelf above your Coloring field, and sorting in Descending order.  You were probably just missing a step in his process--hope this is helpful!  Version 8.1 workbook attached.

          1 of 1 people found this helpful
          • 2. Re: How can I sort a bar graph created using Index()?
            Hope Barrett

            Thanks for your input Matthew! Perhaps my sample data was too simple. The problem I'm encountering is when I remove the sort on "Field", I lose my groupings. For example, here is my viz:

             

            When I create a combined field and put it on the detail shelf, it breaks my color groupings which are created using the post_pro63 sort and the INDEX().

             

             

            I tried preserving the groupings by creating a field that combines the bin and the text field - STR(1)+","+ATTR(post_prop63), but as soon as I remove the sort on the text field, the bins are not populated correctly.

             

            I'm at a loss as to what steps to take next to get the bins to flip.

             

            Hope

            • 3. Re: How can I sort a bar graph created using Index()?
              Matt Lutton

              I'm not sure what to suggest in this scenario; sorry.  You might be able to adjust the URL_Bin calculation to compute across the added dimension as well, but I don't know what impact that will have without experimenting with your view.

               

              If you can mock up a sample workbook that is similar to your own, I'll be happy to look at it.

              1 of 1 people found this helpful
              • 4. Re: Re: How can I sort a bar graph created using Index()?
                Hope Barrett

                Hello Matthew,

                 

                Once again, thank you for your input! I was able to get my view to sort successfully by adjusting the URL_Bin pill:

                 

                Results are computed along post_prop63(URL) (sorted descending by Count of post_prop63(URL)) for each Display Interval-C, timestamp (Years).


                And modifying the sort within the combined field.

                 

                Unfortunately, sorts are still driving me to distraction. I was able to use the URL_Bin to adjust the sort because it was a disaggregated field. However, I have a very similar situation where I am creating bins using an aggregate field and I do not have the option of adjusting the sort withing the pill. Perhaps you've seen this issue before? I was able to create a desensitized data set if you have a moment to review.

                 

                 

                Thanks!

                Hope

                • 5. Re: How can I sort a bar graph created using Index()?
                  Matt Lutton

                  Here you go.

                   

                  In this case, I removed all of the sorts you created and started fresh.

                   

                  On the combined field ONLY, I have set the Sort based on the Usage_Bins aggregation (this is the basically the same process I used on the last example).  It appears you were using the "Usage" field instead of the BINS to sort; plus you had several sorts in place.

                   

                  I hope this helps!

                  • 6. Re: How can I sort a bar graph created using Index()?
                    Hope Barrett

                    Matthew, once again, thanks for your help! I was able to get this work by changing my combined field to use a daily increment instead of monthly (or yearly).