Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Conditional SUM in Pentaho Reports 3.9

  1. #1

    Default 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

    Brad 5
    Mike 2
    Brad 1
    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. #2

    Default

    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.

    Brads total would be BradsTotalApples.

    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
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.