Files to look at:
This example shows how to find the number of a fiscal year, quarter, and week for date-time data fields.
In this example, the Grid dashboard item displays the fiscal year, quarter and week for the corresponding date.
The following expressions calculate fiscal values for the corresponding date.
| Calculated Field | Expression |
|---|---|
| Fiscal Year | GetFiscalYear([OrderDate]) |
| Fiscal Quarter | GetFiscalQuarter([OrderDate]) |
| Fiscal Week of Year | GetFiscalWeekOfYear([OrderDate]) |
All Fiscal methods extend GetFiscalDateFunction and override the GetFiscal method used to calculate fiscal values.
Returns the year of input DateTime if it comes before a new fiscal year beginning date; otherwise returns the year plus 1.
- If a difference between the input DateTime month, and the
startMonthfield not divisible by 3, theGetFiscalmethod returns the whole fraction of the difference by 3 plus 1; otherwise the fiscal quarter function calculates the result for the previous or next month of given DateTime depending on whether the input DateTime day is less or more than thestartDayfield.
- The
Beginningmethod sets the start date of the first week in the input year. - If start date is less, than input date
start = Beginning(current.Year); otherwisestart = Beginning(current.Year - 1). - The function calculates the result as a sum of a difference between the start and input dates and the day of week offset from the first day of week divided by 7.

