> For the complete documentation index, see [llms.txt](https://docs.listburst.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.listburst.app/sharepoint-tips/calculated-column-quarterly-date-grouping.md).

# Calculated fields: Groupings

At some point you'll want to display a chart with data grouped by day, month, quarter or year. For example, here's the number of invoices grouped by Month:&#x20;

![](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MknY5EIsvNDeXFKhuPm%2F-MknYcVXZgKGe5ufJZOu%2Fimage.png?alt=media\&token=5830ab91-1b4f-4c3b-91c0-c29a8962b915)

![Data grouped by month.](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MXxlDmv07pJXuM3zt6G%2F-MXxlmTmDZXOTP_1Z1v8%2Fimage.png?alt=media\&token=068f6807-57ed-484f-a957-6bca656f2b0a)

The short version of this is: create a calculated field which calculates the label (the year and month, in the example above).

Then in your web part configuration, choose your calculated column as the "grouping" field:

![](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MXxlDmv07pJXuM3zt6G%2F-MXxmQf5zO_CBHw8s_zA%2Fimage.png?alt=media\&token=974c66ac-88c3-4209-a295-dea48aac7197)

And for the sort order, choose to sort by categories:

![](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MXxlDmv07pJXuM3zt6G%2F-MXxmZqSjR-88DU_9hfG%2Fimage.png?alt=media\&token=70755045-7074-44d1-8f0b-3bbfd752f28e)

Note that the categories - in this case, a calculated date label - are **automatically recognised as dates**, and will be sorted *chronologically* and not *alphabetically*.

If you'd like to group your data by Financial Quarter, you'll need two things:

* a Date field which is already populated with the correct date for each row
* a Calculated field which calculates the Quarter (or maybe month, year, etc).

The formula for to produce a Quarter calculated field, where Q1 is January-March, is as follows:

```
=YEAR(Created)&" Q"&CHOOSE(MONTH(Created),1,1,1,2,2,2,3,3,3,4,4,4)
```

The formula uses `Created` as the date field - change this if you have another date field.

It's easy to customise - e.g. if your Q1 starts in April, try this instead;

```
=YEAR(Created)&" Q"&CHOOSE(MONTH(Created),4,4,4,1,1,1,2,2,2,3,3,3)
```

Simply create a calculated field and paste the formula in:

![](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MBQEhkQy8lKTRoVIWlw%2F-MBQGIQ9R5JrXFGn468X%2Fimage.png?alt=media\&token=2be517b4-ebca-4b94-a888-8d4eeac73d37)

{% hint style="warning" %}
Note that the output type of this calculated field must be **Text**. Grouping/Aggregation does not work for other types.
{% endhint %}

The output in your SharePoint list will be something like this:

![](https://2862469232-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9dDlLIQkrUpGsZtrA4%2F-MBQEhkQy8lKTRoVIWlw%2F-MBQGTcWwg4xLAdPg0gf%2Fimage.png?alt=media\&token=f6522b65-28cc-4ff9-82f4-7d0f219b9195)

The reason the Year component is first is so that the field is easily sortable. You can then use this to display a Quarterly sales chart, for example.
