cancel
Showing results for 
Search instead for 
Did you mean: 

Group subtraction

Former Member
0 Kudos

Please I need assistance on my table.

Table 1

a                   b

revenue        5

revenue        6

revenue        2

expense        4

expense        6

expense        3

in the above table 1 was able to group them

as

total revenue 13

total expense 13

where my problem lies is to subtract total revenue-total expense

what formula can i use in crystal report?

thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Abiodun,

Create this formula and place it on the Group Footer:

whileprintingrecords;

numbervar revenue;

numbervar expense;

if {database_field} = "Revenue" then

    revenue := Sum({measure_field}, {Group_field}) //replace {measure field} with the column name that contains values and {Group_field} with the database field that is used in the Group Expert

else if {database_field} = "Expense" then

    expense:= Sum({measure_field}, {Group_field})

Then, create this formula and place it on the Report Footer:

whileprintingrecords;

numbervar revenue;

numbervar expense;

revenue - expense;

Hope this helps!

-Abhilash

Former Member
0 Kudos

Thank you-it works

Answers (0)