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 the diference between the input DateTime month and the startMonth
field is not divisible by 3, the GetFiscal
method 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 the startDay
field.
- The
Beginning
method sets the start date of the first week in the input year. If start date is more than input date, the program calculates start date for the previous fiscal year. - 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.