You are on page 1of 3

Name of Solution:

Informatica Developer : Calculating Moving Sum Avg

Business Requirement:
Informatica Developer mapping sample that demonstrates how to use inbuilt functions to
calculate Cumulative totals, Moving Sum, Moving Avg.

Solution URL:
https://community.informatica.com/solutions/2345

Description:
The transformation language contains valuable functions that make it easy for populating
columns required for business reporting and analysis.
CUME and similar functions (such as MOVINGAVG and MOVINGSUM) can simplify reporting
by calculating running values.
Implementation Details:

The mapping uses the following file as source :

Date

Sales

12/1/2012

100

12/2/2012

90

12/3/2012

120

12/4/2012

70

12/5/2012

150

12/6/2012

60

12/7/2012

50

12/9/2012

100

12/10/2012

40

The inbuilt transformation functions are used to calculate cumulative total, 2-day Moving
Sum, 3-day MovingAvg for the sales quantity to populate the following target structure.

Date

Sales

Cumulative_total

2012-12-01

100

100

00:00:00

MovingSum

MovingAvg

2012-12-02

90

190

190

120

310

210

103

70

380

190

93

150

530

220

113

60

590

210

93

50

640

110

87

100

740

150

70

40

780

140

63

00:00:00
2012-12-03
00:00:00
2012-12-04
00:00:00
2012-12-05
00:00:00
2012-12-06
00:00:00
2012-12-07
00:00:00
2012-12-09
00:00:00
2012-12-10
00:00:00

Download file contents:


1. Mapping
2. Source File

Steps to implement the solution:


1. Import mapping xml to the repository, select the appropriate folder from repository
and resolve the conflicts by choosing suitable option.
2. Copy the source file Product.csv into
< Informatica server > \tomcat\bin\source.
3. Open mapping in Informatica Developer, Observe the sorter transformation as shown
below.

Observe the use of aggregate function in expression transformation as shown below.

4. Validate and Run the Mapping.

You might also like