Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions
  8. Creating Custom Functions
  9. Custom Function API Reference

Transformation Language Reference

Transformation Language Reference

VARIANCE

VARIANCE

Returns the variance of a value you pass to it. VARIANCE is used to analyze statistical data. You can nest only one other aggregate function within VARIANCE, and the nested function must return a Numeric datatype.

Syntax

VARIANCE(
numeric_value
[,
filter_condition
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
numeric_value
Required
Numeric datatype. Passes the values for which you want to calculate a variance. You can enter any valid transformation expression.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

Double value.
NULL if all values passed to the function are NULL or if no rows are selected (for example, the
filter_condition
evaluates to FALSE or NULL for all rows).

Nulls

If a single value is NULL, VARIANCE ignores it. However, if all values passed to the function are NULL or if no rows are selected, VARIANCE returns NULL.
By default, the
PowerCenter Integration Service
treats null values as NULLs in aggregate functions. If you pass an entire port or group of null values, the function returns NULL. However, when you configure the
PowerCenter Integration Service
, you can choose how you want to handle null values in aggregate functions. You can treat null values as 0 in aggregate functions or as NULL.

Group By

VARIANCE groups values based on group by ports you define in the transformation, returning one result for each group.
If there is not a group by port, VARIANCE treats all rows as one group, returning one value.

Example

The following expression calculates the variance of all rows in the TOTAL_SALES port:
VARIANCE( TOTAL_SALES )
TOTAL_SALES
2198.0
2256.0
3001.0
NULL
8953.0
RETURN VALUE:
  10592444.6666667