IIF statement on a report

S

Secret Squirrel

I have two fields on my report, one is "PaymentMethod" and the other is
"ExpenseAmount".

The PaymentMethod can be either "AMEX" or "CASH". How can I create an IIF
statement to sum the totals for each method?

I tried to create these two text boxes on my footer but it didn't seem to
work:

IIF([PaymentMethod]="AMEX",Sum([ExpenseAmount]),0)

IIF([PaymentMethod]="CASH",Sum([ExpenseAmount]),0)
 
S

Steve Schapel

Squirrel,

=Sum([ExpenseAmount]*IIf([PaymentMethod]="AMEX",1,0))

Slightly simpler, but perhaps less intuitive:

=Abs(Sum([ExpenseAmount]*([PaymentMethod]="AMEX")))
 
Top