Wednesday, 6 January 2016

Conditional Aggregate Functions in Informatica

Problem :


Data is coming in one field like

 

Amount(input)

-----------

1

2

13

-1

-2

-10

 

 

Want output like in two different columns in one table

 

Sum_positive      Sum_Negative

-------------------       ---------------------

16                        -13


Solution : 

Easier option would be to use the "conditional aggregate functions":

 

Set one output port "sum_positive" of the AGG to this expression:

  Sum( Amount, Amount > 0)

 

Set one output port "sum_negative" of the AGG to this expression:

  Sum( Amount, Amount < 0)

No comments:

Post a Comment