Group by a Custom Fiscal Year

Here’s how to group by a custom fiscal year.

Example 

1q = load "opportunities";
2q = group q by 'CreatedDate_Year_Fiscal';
3q = foreach q generate
4   'CreatedDate_Year_Fiscal' as 'Fiscal Year',
5   count() as 'count';
6q = order q by 'CreatedDate_Year_Fiscal' asc;
7q = limit q 2000;

The query returns:

Fiscal YearCount
20172
20181
20191
20201
20211
20221