Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

A.40 Tutorial A-5 Comparative Income Statement, Part 2

  1. 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.
  2. 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.
  3. Right-click on the Row #2 summary field and select Format Field. This opens the Format Field dialog box.
  4. On the Number tab, click the Customize button.
  5. For the Reverse Sign on Display option, click the Formula button directly beside it.
  6. 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;

  1. 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.
  2. Click the Save and Close button and then click the OK button to save your changes and return to the report designer.