2 Replies Latest reply on Mar 29, 2012 8:45 AM by Tracy Rodgers

    date sorting in hierarchy

    Erling Alfheim



      I have an interesting problem in tableau that I'm wondering if is a bug or if its just some elaborate feature I've not understood.


      I have a simple table where I have dates as the rows. I've sorted the days in descending order so that the newest date is on top. (For some reason I need to do this on the pill is the row container, as the default sorting set on the field is ignored.


      However after collapsing and expanding the hierarchy (collapsing days into months, and expanding to days again for example) the sort order is reversed.


      Has anyone else come across this?

      Is this a bug? is there a setting somewhere I can't find? is there a workaround?

        • 1. Re: date sorting in hierarchy
          Jonathan Drummey

          I'm assuming you are using the blue (datepart) pills and sorting them using the quick sort in Tableau v7? And from your description you are applying a quick sort to DAY(Date) and then collapsing the hierarchy so DAY(Date) is no longer in the view, then when expand the hierarchy again the sort is lost?


          The quick sort feature is new in v7, and right now it's just a sort in the current state of the view. When you are adding and removing pills from the view such as by changing hierarchies, the quick sort settings are reset. I'd suggest you submit a feature request to Tableau if you really need this.


          As for having a default sort, Tableau seems to always want to format dates left to right, top to bottom in ascending order, so it ignores whatever you try to set for a default sort order.


          There is a workaround, though.  If you want to have a custom sort on date that changes, you can roll your own creating one or more calcs like YEAR([Date]), MONTH([Date]), etc., change them to dimensions and then setting the default sorts for those values. You can put those calcs into a hierarchy so it will work just like the hierarchy on other date fields.  See the attached for an example.



          1 of 1 people found this helpful
          • 2. Re: date sorting in hierarchy
            Tracy Rodgers

            Hi Erling,


            Another possible option (though maybe not ideal) in addition to Jonathan's is to set the Date field to be a discrete exact date. Place this on the rows shelf to the left of years, months, etc. Then, sort the exact date in Descending Order. Right click on the exact date pill and uncheck Show Header.  Now, clicking up and down in the hierarchy will be the same.



            1 of 1 people found this helpful