Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

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 Year Count
2017 2
2018 1
2019 1
2020 1
2021 1
2022 1