Files to look at:
This example shows how to create and register custom functions that calculate the fiscal year, quarter, and week from 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]) |
The following code snippet shows how to register fiscal functions:
C# 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]));
VB 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)))