5 Replies Latest reply on Feb 27, 2017 6:15 AM by Jim Dehner

    Sorting by semesters/dates

    cindy baker

      Hello,

      I'm unable to figure out a way to sort data by semester. For example, spring 2011 then fall 2011, then spring 2012, then fall 2012, etc.

       

      I tried using J11 (for January) then S11 (for September) but the sort was then J11, J12, J13, J14...S11, S12, S13, S14, etc.

       

      Any ideas on how to get the data in the Semester_Name order?

       

         

      Semester_NameSemester_Order
      SP111J11SM1
      FA112S11SM2
      SP123J12SM3
      FA124S12SM4
      SP135J13SM5
      FA136S13SM6
      SP147J14SM7
      FA148S14SM8
      SP159J15SM9
      FA1510S15SM10
      SP1611J16SM11
      FA1612S16SM12
      SP1713J17SM13
        • 1. Re: Sorting by semesters/dates
          Jim Dehner

          Hi Cindy

           

          I could not open your file because it references a data source that is not included - you would need to export a packaged workbook to include the data

           

          That said - what I would suggest is to

          1. create a "Sort Field" like you did with semester order
          2. drag it to your rows shelf in the first position
          3. then hide it by right clicking the pill and clicking on hide

           

          The data will remain sorted but the sorting field will not show

           

          Let me know if that worked for you

          Jim

          2 of 2 people found this helpful
          • 2. Re: Sorting by semesters/dates
            cindy baker

            Hi Jim,

            Thank you for the quick response, that's exactly what I needed. I was missing the fact that I could hide the sorting field.

             

            What you suggested worked for me but created another issue. Tableau isn't reading my data as time series data so I cannot use a line chart. Ideas on how to use a line chart? I tried converting some fields to date fields and that didn't seem to yield the results I wanted.

            • 3. Re: Sorting by semesters/dates
              Jim Dehner

              Thanks - Glad to help

              Joped to avoid making a date out of the data

              The fields that you have are strings and not date fields - if you are pulling the field from another source (like excel or SQL) you could convert it to a date at the source in the form of mm/yyyy. If not you will need to convert it to a date field in Tableau - e.g., if your field name is date and the  value is "Spring 2011"  you could use a formula like for the year like Year= Year(right([date]),4) and for the month you could use   Month= If Contains([date, 'Spring') Then 6 else 9 End

               

              You then would make the date with Makedate(Year,Month,'01' )

               

              Now you have a date field that you can use for sorting or other calculatons

               

              Does that help?

              Jim

              1 of 1 people found this helpful
              • 4. Re: Sorting by semesters/dates
                cindy baker

                Thanks Jim - both answers you provided were quite helpful. Thanks for the quick responses, the easy to follow directions and for helping me out - it is all very much appreciated!!!

                • 5. Re: Sorting by semesters/dates
                  Jim Dehner

                  You are welcome - my wife is a retired teacher so whenever I see anything that has to do with schools it get my attention

                  Jim