Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF Formula returns SUM of ALL instead of SUM of selected amount... 1

Status
Not open for further replies.

kagee

Programmer
Apr 21, 2004
30
NL
Hi,

Am rather new to Crystal and urgently need to do some data selection for financial reporting purposes.
Crystal version: 8.5
Database and connectivity: SQL Server

Sample data:
Am using a Sequel view to select the following data
Date, Account No, Account Desc, Amounts

The SQL view is able to return both income amounts and expenses amounts. The main difference between the incomes and the expenses is the account No. (incomes are '61110*' while expenses are '61190*')

Present Scenario:
Currently, I have an IF formula to separate the two but it returns the TOTAL amount and not the selected amount

IF {table.Account}like "61110*" then SUM({table.amount}) else 0
--the IF returns the whole SUM of both incomes & expenses yet i want TOTAL/SUM of INCOMES alone!

Please Assist,
MIKE
 
Not sure what else you might be doing but I would expect to see a formula :

IF {table.Account}like "61110*" then {table.amount} else 0

and then use a summary function to Sum this formula.

Your formula will either show the total of all records or zero depending on whether the current record has a matching account number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top