I am creating a Cash Flow statement for my company using Crystal Reports XI. It will be a Cash Flow report showing changes in sources and uses of cash from month to month. I have come up with a formula that calculates last months account balance for each account. I created a parameter called date that allows the user to enter the date for the report. Then one formula figures the balance for the account for this month, and the formula below calculates the formula for last month. Then I sum them and subtract them to get the change in the account. To get last months number I simply subtracted 1 from the month. This works great for months Feb through December. However, I can't figure out what I need to do for the month of January. Because, for the month of January, 1 - 1 = 0, not 12. How can I change my formula below to account for this condition that only occurs once per year:
//this works for last month
if {GLPerBal.FiscalPeriod} = month({?Date})-1 and {GLPerBal.FiscalYear} = year({?Date}) and {GLPerBal.Chart} in ["105000"] then
if {GLPerBal.FiscalPeriod} <> 0 then
{GLPerBal.CreditAmt} + {GLPerBal.DebitAmt}