# 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;

![](/files/-MknYcVXZgKGe5ufJZOu)

![Data grouped by month.](/files/-MXxlmTmDZXOTP_1Z1v8)

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:

![](/files/-MXxmQf5zO_CBHw8s_zA)

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

![](/files/-MXxmZqSjR-88DU_9hfG)

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:

![](/files/-MBQGIQ9R5JrXFGn468X)

{% 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:

![](/files/-MBQGTcWwg4xLAdPg0gf)

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.listburst.app/sharepoint-tips/calculated-column-quarterly-date-grouping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
