# Thread: Conditional SUM in Pentaho Reports 3.9

1. Junior Member
Join Date
Jun 2013
Posts
1

## Conditional SUM in Pentaho Reports 3.9

Conditional SUM in Pentaho Reports 3.9

I have a problem.

I am not being able to calculate a conditional sum function.

For example, a table like this

Name Apples

Mike 2
Peter 4

I want to get the a function to calculate

-the sum of apples just for Brad (7)
-sum of apples just for Brad (7) minus the sum of apples just for Peter (4). Result (7-4=3)

Anyone could help me?

Thanks
Last edited by gonzaloruzafa; 06-07-2013 at 06:06 PM. Reason: Error

2. Member
Join Date
Oct 2006
Posts
80
Create a function called BradsApples. Use an If statement, If name = "Brad" then Apples else 0. Then create a sum function called BradsTotalApples which sums BradsApples. Do the same for each name.

Sum of Apples For Brad minus Apples for Peter would be BradsTotalApples - PetersTotalApples.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•