In the image above we can see inside of a aggregation transformation in Informatica Powercenter. So Aggr transformation can be any of those, Avg, Count, First, last, SUM, etc.
For our example I will use this as baseline:
We have the SQ_EMP_FILE table and here’s how I want this table to look like after my Powercenter workflow is complete:
So, instead of doing via SQL, let’s do via Powercenter.
Aggregation Transformation with Powercenter
The image above shows final Powercenter mapping. Here’s how to do it:
- Create a mapping
- drag your source to your mapping
- create a new transformation of type Aggregation
- edit/adjust your transformation
- create a target
- relate your aggr transformation to your target
- make sure you have a table created in your database for your target
- create a workflow
- run your workflow
- check the results
- the end 🙂
I assume you already know how to create a source and a target, so let’s talk about the transformation itself, steps 3 and 4.
By following the steps shown in those images above you will be able to have your transformation.
Now drag from your Source Qualifier to your Aggr Transformation the field LOCATION, JAN_SALARY and FEB_SALARY.
Now double click your transformation so we can Edit it.
As you can see, couple of things needs to be done.
- Check group by on LOCATION
- Uncheck output for JAN and FEB salary,
- Create a new field
- Name it TOTAL_GERAL
- Uncheck TOTAL_GERAL input port
- Edit TOTAL_GERAL expression
- Add this to TOTAL_GERAL expression: SUM(JAN_SALARY+FEB_SALARY)
- Drag to your target Location to Location and Total_Geral to Total_Geral
Why does it happen this way?
Because Powercenter ( like DAX ) creates just-in-time variables that store JAN and FEB totals (grouping by Location, on this example) and do it LINE by LINE, and once the entire source is mapped those results are thrown to the target and recorded in your database.
As you can see our resulting table is showing exactly what was expected of it!