2

I formatted my list to group by dates in a format of MMM YYYY in an ascending order. The formula I used was:

=TEXT([Start date],"mmm yyyy")

However, now SharePoint groups the dates using alphabetical order rather than chronological order which results in this:

Dates formatted as MMM YYYY

Is there a way I could still display these in a chronological order but to maintain formatting as MMM YYYY?

2 Answers 2

1

When you use a calculated column to format a date the field becomes text and is then sorted alphabetically. What you want is to keep the field as a Date so that it is sortable (and filterable) in the way you'd expect but then apply formatting to get the look you want. Here is a format you can apply to the view (View Menu > Format this View > Advanced):

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "groupProps": {
    "headerFormatter":{
      "elmType": "span",
      "txtContent": "=if(getMonth(@group.fieldData)==0,'Jan ',if(getMonth(@group.fieldData)==1,'Feb ',if(getMonth(@group.fieldData)==2,'Mar ',if(getMonth(@group.fieldData)==3,'Apr ',if(getMonth(@group.fieldData)==4,'May ',if(getMonth(@group.fieldData)==5,'Jun ',if(getMonth(@group.fieldData)==6,'Jul ',if(getMonth(@group.fieldData)==7,'Aug ',if(getMonth(@group.fieldData)==8,'Sept ',if(getMonth(@group.fieldData)==9,'Oct ',if(getMonth(@group.fieldData)==10,'Nov ','Dec '))))))))))) + getYear(@group.fieldData) + ' (' + @group.count + ')'"
    }
  }
}

Here's what it looks like (grouped by Due): enter image description here

1
  • 1
    This worked perfectly! Many thanks!
    – Marlena
    7 hours ago
0

This is an expected behavior in SharePoint as you are formatting date column as a "Text" using calculated column.

And then you are grouping list view based on text column in ascending order (A, B, C...):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.