Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Overview

Aggregate functions aggregate data, often grouped by other attributes, to give totals, max, min, average values etc. for each key value.  For example, you can sum the amount of all the lines on an invoice based on an invoice ID.

Aggregate functions are available in stream views and pipes.

Aggregation on a Pipe.

Pipe aggregation is useful for simple aggregations. To configure a pipe for aggregation

  1. Click on the pipe to open its properties.
  2. In the Aggregate Attributes section, click the plus button.
  3. Complete the details
    1. A Function: select the function you wish to perform e.g. sum.
    2. Attribute: select the attribute you wish to perform the function on.
    3. Name: Aggregation produces a value

Example

See Using an Aggregate Stream


Functions

FunctionDescription
Average

This function returns the arithmetic average value of an attribute from records with the same key value.

In detail, it returns the sum of all values for a key value, divided by the number of values that are not null.

It is only available for numeric attributes.

CountThis function returns the number of non-null values of an attribute from records with the same key value.
DistinctThis function returns the number of unique values of an attribute from records with the same key value.
Maximum

This function returns the maximum value of an attribute from records with the same key value.

It is available for numeric, string and date/time attributes.

Strings are ordered alphabetically, with the shortest strings first.

Minimum

This function returns the minimum value of an attribute from records with the same key value.

It is available for numeric, string and date/time attributes.

 Strings are ordered alphabetically, with the shortest strings first.

Percent

The percent function is only available for PhixFlow instances running on an Oracle database.

This function can be applied to a numeric field, to return the percentage of the sum of values for each key value in relation to the total sum of values.

You should use this function in conjunction with one or more grouping attributes - each combination of values from these grouping attributes gives a key value.

For example, you have a stream with 2 fields:

NumberLabel
12A
14B
13C
10A
5A
2

B

and you create a grid view:

  • dragging in the attribute Label - which automatically becomes a grouping attribute when one or more of the other attributes are aggregated
  • dragging in the attribute Number, and applying the aggregate function Percent
  • setting the rounding on the stream view attribute Number to 2 decimal places

This will give the view:

NumberLabel
48.22A
28.57B
23.21C
Sum

This function returns the sum of all values of an attribute from records with the same key value.

It is only available for numeric attributes.



  • No labels