COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: psteffen on 18 Jan 2010 11:30:14 AM

Title: Need Net Total Instead of Grand Total
Post by: psteffen on 18 Jan 2010 11:30:14 AM
I can do subtotals and grand totals and that is not a problem.  With financial summaries (such as income statements), you do not use a grand total at the bottom, instead you use a net total (revenues less expenses). 
Many of my reports will have four columns (and four different net totals – modified budget, YTD, encumbrances, and available balance).  In essence I need to take the sum of accounts where the account number begins with a 4 less the sum of accounts where the account number begins with a 5 (and could have other additions and subtractions in the formula for account numbers starting with a separate number). 

Any help on how to do this is greatly appreciated.
Thank you
Title: Re: Need Net Total Instead of Grand Total
Post by: cschnu on 18 Jan 2010 01:43:47 PM
You will need to make an if statement for your total expression. So click on the data item that represents the total in your query and change it to something along these lines:
if ([ACCOUNT_TYPE] = '4') THEN
([SUM_YEAR_TO_DATE_ACTIVITY] * -1)
ELSE
([SUM_YEAR_TO_DATE_ACTIVITY])
Title: Re: Need Net Total Instead of Grand Total
Post by: psteffen on 19 Jan 2010 08:51:13 AM
That did it - thanks for the help!