none
Custom sort for "month" column RRS feed

  • Question

  • Hello,

    I'd like to sort months chronologically like Jan, Feb, Mar....  Currently I only have the option to sort alphabetically.  I don't think I have the option to fix it programmatically.

    Thanks,

    Monday, August 15, 2016 2:03 PM

Answers

  • Thanks, Wendy. Sounds good.

    I've found another option.  I've made two calculated columns from a  date field, in my case "Journal_Date"

    =""&YEAR(Journal_Date)

    =REPT(" ",13-MONTH(Journal_Date))&TEXT(Journal_Date,"mmmm")

    Then I sorted on year then on month.  Lastly I grouped on year (descending), then on month.  Check out https://blog.pathtosharepoint.com/2013/10/31/trick-or-treat-group-items-by-month/ for more details.

    Thanks to everyone who responded.  I've learned so much about calculated fields in this thread.

    
    • Marked as answer by SavedGirl Friday, August 19, 2016 12:46 PM
    Friday, August 19, 2016 12:46 PM

All replies

  • Hi Saved- you have a couple options- add a number before the month, like 1-January, 2-February, etc. Or you could use a calculated column to output a number based on the month, then sort by that column instead.


    cameron rautmann

    Monday, August 15, 2016 3:40 PM
  • As Cameron said, add a calculated column and use the Month function, "=Month(yourfield)", and set the data type returned to Number.


    Mike Smith TechTrainingNotes.blogspot.com
    Books: SharePoint 2007 2010 Customization for the Site Owner, SharePoint 2010 Security for the Site Owner

    Monday, August 15, 2016 4:13 PM
  • Hi SavedGirl

    I agreed with the above, please check if the replies help you. If yes, please remember to mark them as answer, it will be beneficial to others in this forum who meet the same issue in the future.

    Thanks for your understanding!

    Regards,

    Wendy


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, August 16, 2016 7:23 AM
    Moderator
  • Hello,

    Thanks so much for your help.  So far preceding the number in front of the month is the one that I can do.  I've been working for a couple of hours on the calculated column.  I'll try again later.  I got the month to appear corresponding to the number.  I want to do a secondary sort on the month and a secondary group of the month.  Any ideas?

    Thanks again,

    SavedGirl

    Tuesday, August 16, 2016 2:29 PM
  • What do you mean by secondary sort on the month? You can only sort the month column once. However, you can additionally filter other columns. You may want to go into your view settings and look at the "group by" section to further group your information.

    cameron rautmann

    Tuesday, August 16, 2016 2:53 PM
  • Secondary to what? Year? If so, add another calculated column with "=Year(yourDateColumn) and then in your view group by the Year column and then by the Month column.


    Mike Smith TechTrainingNotes.blogspot.com
    Books: SharePoint 2007 2010 Customization for the Site Owner, SharePoint 2010 Security for the Site Owner

    Tuesday, August 16, 2016 3:39 PM
  • Hi Mike,

    I meant to say I'd like to group on the year first, then the month.  Actually everything's fine until I try grouping.  Then the months revert to sorting alphabetically. 

    Thanks everyone for your input.  Very encouraging. :-)

    SavedGirl

    Tuesday, August 16, 2016 6:21 PM
  • Hi SavedGirl,

    As a workaround, you could try to create a calculated column called YM, and set the formula to:

    =TEXT(Date1,"YYYY")&"."&TEXT(Date1,"MM")

    The "Date1" is the name of Date column.

    Then group by using the calculated column.

    The result is like:

    Thanks,

    Wendy


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by croute1 Friday, August 19, 2016 11:59 AM
    Friday, August 19, 2016 9:43 AM
    Moderator
  • Thanks, Wendy. Sounds good.

    I've found another option.  I've made two calculated columns from a  date field, in my case "Journal_Date"

    =""&YEAR(Journal_Date)

    =REPT(" ",13-MONTH(Journal_Date))&TEXT(Journal_Date,"mmmm")

    Then I sorted on year then on month.  Lastly I grouped on year (descending), then on month.  Check out https://blog.pathtosharepoint.com/2013/10/31/trick-or-treat-group-items-by-month/ for more details.

    Thanks to everyone who responded.  I've learned so much about calculated fields in this thread.

    
    • Marked as answer by SavedGirl Friday, August 19, 2016 12:46 PM
    Friday, August 19, 2016 12:46 PM
  • I also found out that there can be no spaces in the date field name.  "Journal_date" works in the calculation.  "Journal date" does not.
    Friday, August 19, 2016 2:31 PM
  • FYI- the proper way to use columns with spaces is this: [Journal date]

    cameron rautmann

    Friday, August 19, 2016 2:39 PM