Support our 100% FREE Projects: Donate Now OR Sponsor Now


  

SSIS aggregate transformation

In this step by step SSIS Tutorial I will show you how to use Aggregate Transformation. For the purpose of this tutorial I will use SSIS 2012

Note: We have video version of this tutorial. Please click the button below otherwise scroll down to read text based tutorial.

Subscribe to me on YouTube

The aggregate transformation allow us to aggregate input rows and works the same as SQL GROUP BY with aggregation functions.

Other Versions of SSIS:

  • SSIS 2012
    • This blog post has been written using SSIS 2012
  • SSIS 2008
    • The examples we used should work in SSIS 2008
  • SSIS 2005
    • We suspect that this will work in SSIS 2005 as well

Contents

  • SSIS Aggregate Transformation
    • Aggregate Transformation Basics

Aggregate Transformation Basics

In my first example I will show you how to aggregate the data and show unique customers with the total sales amount.
 

NOTE: SQL is below:

Select dc.CustomerAlternateKey, dc.FirstName, dc.LastName, fs.SalesAmount
From DimCustomer As dc INNER Join FactInternetSales As fs
On dc.CustomerKey = fs.CustomerKey 
Where (dc.CustomerAlternateKey IN ('AW00021700','AW00021701'))
 
I have got an open package in Visual Studio In a data flow I have got  OLE DB Source and AdventureWorksDW2012 in a connection Menager.

 
 
I open OLE DB Source Editor showing the SQL code. I open OLE DB Source Editor showing the SQL code. I click Preview.
 
 
I have limited the data to 2 Customers only. We can see that I have got CustomerAlternateKey with FirstName, LastName and SalesAmount. So we can see that the first customer vote something twice and the second Customer vote somethin four times.  So I will aggregate the data and show unique customers with the total sales amount so my output should be two rows and aggregated sales amount using SUM() function. And I will do that using Aggregate transformation. 
 
 I drag the aggregate from toolbox I will create path between them and I will double click the Aggregate.
 
 
I have got four columns but I will only use three. I select FirstName, LastName  the data is populated at the bottom. The operation for them will be Group BY. I select one more fild SalesAmout and in OutputAlias I type TotalSalesAmount the defult operation is Sum. 
 
 
To preview the data I will use derived column. I create new data path and Unable data viewer.
 

 
I run the package and I get two clients with total sales amount.
 
 
So that is on the very basic level aggregate function.
I hope that will help 
Katie 
Share: Share on FacebookShare on Google PlusTweet it
Comments Add Comment
Name: Gunga Din
Comment:

The example was very poor - what table was the aggregate going into ?


Date Posted: 08/05/2013 12:30:38 AM

Name: Emil
Comment:

Hi

This tutorial focuses on the aggregate transformation and does not load the data into a table but previews the end result using data viewer which allow us to access data from memory buffer which is a virtual table used by SSIS during processing.

All our videos and articles follow the same approach where we avoid doing steps that are not directly relevent to the video or article.

Take care

Emil


Date Posted: 09/05/2013 1:57:17 PM

Share your thoughts, questions and suggest improvements:
Add Comment

You found us! Below are 50 most popular searched keywords

created at TagCrowd.com

Disclaimer: While every caution has been taken to provide our readers with most accurate information and honest analysis, please use your discretion before taking any decisions based on the information in this blog. Author will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.