Calculation Package Obejective:  Will Calculate the total order by product. Wil calculate the total average by product. Will Calculate The total cost of the product. From Database source to Flat file destination
Target Outcome: ( SQL code) Use Adventureworks Select  p.ProductID, sum(p.Quantity) as [Quantity Sum], Sum(p.Quantity*ActualCost) as [Total Cost],  avg([t].[Total Cost]/[t].[Quantity Sum]) as [average] from  Production.TransactionHistoryArchive p ,(Select  ProductID, sum(Quantity) as [Quantity Sum], Sum(Quantity*ActualCost) as [Total Cost] from Production.TransactionHistoryArchive group by ProductID) t where p.ProductID = t.ProductID group by p.ProductID order by p.ProductID
Target Outcome : (SQL code) Snapshot:
Contol Flow
Note: Some task are created for testing purposes.
 
Data Flow Calculate values
Note : Some transformation are added for testing purposes .
Source: OLEDB Destination: dbo.Adventureworks SELECT  ProductID,Quantity,ActualCost FROM  Production.TransactionHistoryArchive
Derived Column: Calculate LineItemTotalCost Quantity * ActualCost
Aggregate : Sum Quantity and LineItemTotalCost [ProductID] = Group By(ProductID) [QuantitySum] = Sum (Quantity) [TotalCostById] = Sum(LineItemTotalCost)
Derived Column 2: Calculate Average Cost [AvgCostByID] = TotalCostByID / QuantitySum
Sort Transformation: Sort by ProductID Order By Product ID Desc
Destination: Flat File Destination: Load Data C:\DOCUME~1\KARLO~1.CAM\LOCALS~1\Temp
Configuration Package This will support the file system task for locating the specific flat file in the hard drive.
Destination
 

Calculation Package

  • 1.
    Calculation Package Obejective: Will Calculate the total order by product. Wil calculate the total average by product. Will Calculate The total cost of the product. From Database source to Flat file destination
  • 2.
    Target Outcome: (SQL code) Use Adventureworks Select p.ProductID, sum(p.Quantity) as [Quantity Sum], Sum(p.Quantity*ActualCost) as [Total Cost], avg([t].[Total Cost]/[t].[Quantity Sum]) as [average] from Production.TransactionHistoryArchive p ,(Select ProductID, sum(Quantity) as [Quantity Sum], Sum(Quantity*ActualCost) as [Total Cost] from Production.TransactionHistoryArchive group by ProductID) t where p.ProductID = t.ProductID group by p.ProductID order by p.ProductID
  • 3.
    Target Outcome :(SQL code) Snapshot:
  • 4.
  • 5.
    Note: Some taskare created for testing purposes.
  • 6.
  • 7.
  • 8.
    Note : Sometransformation are added for testing purposes .
  • 9.
    Source: OLEDB Destination:dbo.Adventureworks SELECT ProductID,Quantity,ActualCost FROM Production.TransactionHistoryArchive
  • 10.
    Derived Column: CalculateLineItemTotalCost Quantity * ActualCost
  • 11.
    Aggregate : SumQuantity and LineItemTotalCost [ProductID] = Group By(ProductID) [QuantitySum] = Sum (Quantity) [TotalCostById] = Sum(LineItemTotalCost)
  • 12.
    Derived Column 2:Calculate Average Cost [AvgCostByID] = TotalCostByID / QuantitySum
  • 13.
    Sort Transformation: Sortby ProductID Order By Product ID Desc
  • 14.
    Destination: Flat FileDestination: Load Data C:\DOCUME~1\KARLO~1.CAM\LOCALS~1\Temp
  • 15.
    Configuration Package Thiswill support the file system task for locating the specific flat file in the hard drive.
  • 16.
  • 17.