Grouping Pivot Table Dates by Fiscal Year

You can group the dates in a pivot table in different increments, such as by year and quarter.

However, the grouping options are based on the calendar year, and there are no options for grouping pivot table dates by fiscal year. If you want to group the dates by your company’s fiscal year, which starts in July, there’s no built-in way to do that.

Pivot Table dates grouped by year and quarter

Fiscal Year Workaround

Because there’s no built-in option to group pivot table dates by fiscal year, you’ll have to use a workaround solution. In the pivot table source data, you can add a column with a formula that calculates the fiscal year, and then add that field to the pivot table.

For example, if your fiscal year starts in July, use the following formula to calculate the fiscal year, where the date is in cell A2:

=YEAR(A2)+(MONTH(A2)>=7)

The formula calculates the year of the date in cell A2. Then, it calculates the month of the date in cell A2, and checks to see if the month number is 7 or higher. If the month is less than 7, then zero will be added to the year, otherwise 1 will be added.

In the screenshot below, you can see the fiscal year formula for dates in June and July.

Fiscal Year formula

Fiscal Quarter Workaround

If you also want to group the pivot table dates by the fiscal quarter, you can add another column to the pivot table source data. Use this formula to calculate the fiscal quarter, if the fiscal year starts in July.

=CHOOSE(MONTH(A2),3,3,3,4,4,4,1,1,1,2,2,2)

The Choose formula calculates the month of the date in cell A2. Based on the month number, the formula selects the appropriate fiscal quarter number from the numbers that follow. For example, if the month is June, the month number is 6. In the Choose formula, the sixth number is 4, so June is in fiscal quarter 4.

In the screenshot below, you can see the fiscal quarter formula for dates in June and July.

fiscal quarter formula for dates in June and July

Add the Fiscal Dates to the Pivot Table

If you had grouped year and quarter dates in the pivot table, ungroup them and remove them.

Refresh the pivot table, and add the fiscal year and fiscal quarter fields to the Row Labels area.

fiscal year and fiscal quarter fields in pivot table

Videos: Pivot Table Grouping

Learn more about pivot table grouping, and get a workbook with sample file that you can use for testing. Go to the How to Group Pivot Table Data page on my Contextures website.

First, this video shows how to group Text items in a pivot table.

Next, this short video shows the basics of pivot table grouping

Stop Pivot Table Date Grouping

When you add a date field to your Pivot Table, Excel automatically groups the dates into a hierarchy, such as years and months. See how to stop pivot table date grouping in the latest versions of Excel, and a couple of workarounds for Excel 2016. You can also read about why this feature was added, and watch a date grouping video.

Prevent Date Grouping

It’s easy to prevent automatic date grouping for pivot tables in Excel 2019/365, by changing a setting. See the simple steps below.

For Excel 2016, it takes more work — use either the Excel 2016 Workaround, or the Excel 2016 Registry tweak, described below.

Further down in this blog post, you can read more about date grouping in Filters, and the benefit of pivot table date grouping, which started in Excel 2016.

Excel 2019/365 Setting

If you’re using Excel 2019 or Excel for Office 365, there’s good news. You don’t have to use workarounds or make changes to the registry. Now, you can simply change one of the Excel options, to stop pivot table date grouping.

NOTE: This is an application-level setting, not a setting for individual workbooks.

To turn this setting off:

pivotgroupdatesoption01

Excel 2016 Workaround

In Excel 2016, there isn’t an easy way turn off pivot table date grouping. However, to prevent dates from automatically grouping in Excel 2016, you can use this 2-step workaround:

grouppivotdates08

Excel 2016 Registry

The only way to turn off pivot table date grouping in Excel 2016, if you’re brave enough, is by making a change to the Windows Registry.

To do that, follow the instructions in this article by Microsoft’s Excel team. Remember to make a backup of the registry first, and read the warning at the top of that page.

Date Grouping in Filters

Starting in Excel 2007, dates have been automatically grouped into a hierarchy, such as years and months, when you turn on an AutoFilter or create a named Excel table.

You can change an Excel option to turn that automatic grouping on or off, and there are instructions and a video on my Contextures website.

groupdatesfilter01

Date Grouping in Pivot Tables

Pivot Tables dates weren’t grouped in earlier versions of Excel, but that behaviour changed in Excel 2016. Since that version, dates in Pivot tables have been automatically grouped too.

Here’s a pivot table in which I added the Category and OrderDate fields to the Rows area. Because of the date grouping, extra columns were automatically created, to show the Years and Quarters, as well as the Order Date.

grouppivotdates01

Benefit of Date Grouping

Date grouping in pivot tables can be a helpful feature, and this archived blog post from the Excel team explains why this feature was added.

Implementing grouping for Data Model PivotTables allows for grouping to be used in conjunction with the power of the xVelocity engine and is a key feature for making Data Model PivotTables a replacement for native ones in the future. When used in a data model PivotTable, Time grouping adds relevant Date/Time columns such as Date (Year), Date (Quarter) and Date (Month) to the grouped table in the model; these columns could then be reused with other user endpoints of the data model, such as PowerView and Power BI

The date grouping feature can help in normal pivot tables too. For example, with a large dataset, Excel shows an error message if I try to put the date field into the Columns area.

grouppivotdates02

However, Excel allows me to put the Date field into the Rows area, and it automatically groups the dates into Years and Quarters. That saves me the step of having to group the dates manually.

grouppivotdates03

The new fields – Years and Quarters are also automatically added to the PivotTable Fields list.

grouppivotdates04

With these grouped fields, I can move Years into the Columns area, and Excel won’t show an error message about the item limit.

grouppivotdates05

Undo Pivot Table Date Grouping

So, the date grouping feature can be a real time saver, if you usually group the dates manually. But, if you don’t like the grouping feature, there are steps you can take to undo it or stop it, depending on which version of Excel you’re using.

For all versions (Excel 2016 and later), you can manually ungroup the dates, with one of these methods:

Keyboard Shortcut

Ungroup Command

grouppivotdates06

Video: Pivot Table Date Grouping

Watch this video to see how to group the date field in 4-week periods, and set the starting date. There are written instructions on my Contextures website – Group Pivot Table Dates