Comparing Summed Amounts Across Two Fiscal Years for Transactions
In transactions, you can compare summed amounts across two fiscal years.
To compare the summed amounts:
-
On the Criteria subtab, check the Use Expressions box and enter the following on two separate lines:
Date is within this fiscal year to date OR Date is within last fiscal year to date.
-
On the Results subtab, enter the following formulas:
-
If the fiscal year starts in July:
-
For current year to date, Formula (Numeric), SUMMARY TYPE = Sum:
DECODE(TO_CHAR(ADD_MONTHS({trandate},6),'YYYY'), TO_CHAR(ADD_MONTHS({today},6),'YYYY'),{amount},0) -
For previous year to date, Formula (Numeric), SUMMARY TYPE = Sum:
DECODE(TO_CHAR(ADD_MONTHS({trandate},6),'YYYY'), TO_CHAR(ADD_MONTHS({today},-6),'YYYY'),{amount},0)
-
-
If the fiscal year is the calendar year:
-
For current year to date, Formula (Numeric), SUMMARY TYPE = Sum:
DECODE(TO_CHAR({trandate},'YYYY'),TO_CHAR({today},'YYYY'),{amount},0) -
For previous year to date, Formula (Numeric), SUMMARY TYPE = Sum:
DECODE(TO_CHAR({trandate},'YYYY'), TO_CHAR(ADD_MONTHS({today} ,-12),'YYYY'),{amount},0)
-
-
Consider the following:
-
ADD_MONTHScompensates calendar year for current fiscal year (6) and previous fiscal year (- 6) if fiscal year begins in July, and compensates for previous year (-12) if fiscal year is the same as calendar year. -
TO_CHARextracts the (fiscal) years. -
DECODE(value1, value2, {amount}, 0)compares the transaction date's fiscal year value (value1) to the current or previous fiscal year (value2). If equal, use amount; otherwise zero it out.