Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

These are aggregate functions as available on stream views and pipes. Aggregate functions serve the purpose of aggregating data and giving it more meaningful meaning. They are usually a common feature in any data based environment. In database management, for instance aggregate functions are used where multiple rows are grouped together to form a singe value or to find out more significant meaning, represented by a single value on a set of values.

Aggregate functions are also available on pipes and views in PhixFlow. The following comprises a set of available functions (all aggregate function below expect a single argument - field name):

FunctionDescription
Average

This function returns the arithmetic average value of an attribute with the same grouping field values.

In detail, it returns the sum of all values with the same grouping field values divided by the number of values that are not null.

It is only available for numeric attributes.

Maximum

This function returns the maximum value of an attribute with the same grouping field values.

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 with the same grouping field values.

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

 Strings are ordered alphabetically, with the shortest strings first.

Sum

This function returns the sum of all the values of an attribute with the same grouping field values.

It is only available for numeric attributes.

Percent

This function expects a name of numeric field to calculate percentage of sum of numerical values of each group in relation to a whole set of grouped values.

It is therefore necessary to use this function in conjunction with grouping attribute, as otherwise only default grouping would be applied and this would present no meaningful result, as it would always default to 100% (each record would have been in its own group). If however we assume having a file with 2 records, like so:

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

B

and we also assume grouping by "Label", our percent function would return (if applied o "Number" attribute), the following result in a view (assuming we also selected Label attribute to be shown in our view and rounding to 2 decimal places):

NumberLabel
48.22A
28.57B
23.21C

The above are percentages of values assigned to given grouping parameters (A, B, C) as a percentage portion of the whole, computed as sum of all such values.

DistinctThis function returns the number of unique values for the given attribute with the same grouping field values.
CountThis function returns the number of non-null values with the same grouping field values.

 

...

Insert excerpt
_Banners
_Banners
nameanalysis
nopaneltrue

Overview

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

Aggregate functions are available to use on Views and Pipes.

Aggregating with a Pipe

To configure a pipe for aggregation

  1. Click on a pipe to open its properties.
  2. In the Aggregate Attributes section, click the plus button to add a new attribute.
  3. Complete the details:
    1. A Function: select the function you wish to perform e.g. sum. A complete list is provided in the function section at the end of this page.
    2. Attribute: select the attribute you wish to perform the function on.
    3. Name: name your new attribute.
  4. Aggregation on a pipe takes place across all groups of data. Therefore you can define which attribute(s) you wish to group on by adding these to sort/group, or if no grouping is provided aggregation takes place across all records. 
  5. Click 
    Insert excerpt
    _finish
    _finish
    nopaneltrue
     to save your changes.
  6. The table connected to the end of the pipe can now access your attribute using its name. 


Note

You cannot refer to any attributes in the source table for which there is no grouping or aggregate attribute.


Aggregating with a Table

  1. Click on the pipe connecting to an Aggregate Table to open its properties.
  2. Aggregation takes place across all groups of data. Therefore you can define which attribute(s) you wish to group on by adding these to Sort/Group, or if no grouping is provided aggregation takes place across all records.
  3. Click 
    Insert excerpt
    _finish
    _finish
    nopaneltrue
     to save your changes.
  4. The Aggregate Table has access to all attributes on the incoming pipe.
  5. In the Attribute expressions,
    • Use functions to aggregate values e.g. sum(in.Amount) will sum up all amounts within a group.
    • Where multiple values exist for a group they will be treated as an array.
      Use a full stop suffix after the attribute name followed by a number to obtain the record from a group in that position.
      For example in.Name.1 will take the first name in a group.
      Alternatively, use the Functions built into PhixFlow to select the required value.

Aggregate Examples

See Using an Aggregate Table.

Aggregate Functions
Anchor
aggfunc
aggfunc

For the aggregate functions, Cumulative Sum and Cumulative Percent, see View Attribute.

Insert excerpt
Aggregating Data
Aggregating Data
nopaneltrue