- If you preview the report, you’ll see that the balances in the prior year had all their balances negated. You will also notice that the Total column for the account classes is now accurate (this doesn’t apply to the sections yet). The Total column is showing the difference between the category columns. So far, so good.
- Getting the Total column to calculate the difference between the two columns seems to have messed up how the amounts in the prior year column are displayed. They are all negative now and we want them to be positive. In the previous tutorial, we used the option Reverse Sign for Display to reverse the signs for the expense accounts. Now, we need to modify that formula so that it flips the sign for all balances of the prior year. We don’t want to change what it is doing for the current year because that is fine. We need to add additional logic to account for the prior year.
- Right-click on the Row #2 summary field and select Format Field. This opens the Format Field dialog box.
- On the Number tab, click the Customize button.
- For the Reverse Sign on Display option, click the Formula button directly beside it.
- Enter the following formula:
//Flip the sign for current year expenses
Year(GridRowColumnValue("Journal_Entry.Date")) = {?Year To Print}
AND GridRowColumnValue("@Account Class ID") <> 17
OR
//Flip the sign for prior year revenues
Year(GridRowColumnValue("Journal_Entry.Date")) < {?Year To Print}
AND GridRowColumnValue("@Account Class ID") = 17;
- This formula is a bit more complicated because it has to perform the opposite logic depending upon which year is being printed. For the current year, it will continue to reverse the sign for expenses. But for the prior year, it reverses the sign for revenues.
- Click the Save and Close button and then click the OK button to save your changes and return to the report designer.