For example, if an Aggregator transformation uses the same filter condition before calculating sums and averages, you can define this condition as a variable, and then reuse the condition in both aggregate calculations.
You can simplify complex expressions. If an Aggregator includes the same calculation in multiple expressions, you can increase performance by creating a variable to store the results of the calculation.
For example, you might create the following expressions to find both the average salary and the total salary with the same data:
AVG( SALARY, ( ( JOB_STATUS = 'Full-time' ) AND (OFFICE_ID = 1000 ) ) )
SUM( SALARY, ( ( JOB_STATUS = 'Full-time' ) AND (OFFICE_ID = 1000 ) ) )
Instead of entering the same arguments for both calculations, you might create a variable port for each condition in this calculation, and then change the expression to use the variables.
The following table shows how to use variables to simplify complex expressions and temporarily store data:
AVG(SALARY, (V_CONDITION1 AND V_CONDITION2) )
SUM(SALARY, (V_CONDITION1 AND V_CONDITION2) )