Files to look at:
This example shows how to create and register a custom functions that calculates fiscal year, quarter, and week from DateTime 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]) |
To register fiscal functions you should write in code:
CriteriaOperator.RegisterCustomFunction(new GetFiscalYearFunction([first day of year], [first month of year])); CriteriaOperator.RegisterCustomFunction(new GetFiscalQuarterFunction([first day of year], [first month of year])); CriteriaOperator.RegisterCustomFunction(new GetFiscalWeekOfYearFunction([first day of year], [first month of year], [CalendarWeekRule showing how to define the first week], [The first day of week]));