Versions Compared

Key

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

These Aggregate functions are aggregate functions as available on in 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):aggregate data, often grouped by other attributes, to give totals, max, min, avg values etc. for each key value, e.g. for each customer, region.

FunctionDescription
Average

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

grouping field values

key value.

In detail, it returns the sum of all values

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

grouping field values

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

grouping field values

key value.

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

can be applied to a numeric field, to

calculate

return the percentage of the sum of

numerical

values

of

for each

group

key value in relation to

a whole set of grouped

the total sum of values.

It is therefore necessary to

You should 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

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

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)

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
The above are percentages of values assigned to given grouping parameters (A, B, C) as a percentage portion of the whole, computed as


Sum

This function returns the sum of all

such

values

.DistinctThis function returns the number of unique values for the given attribute

of an attribute from records with the same

grouping field values.CountThis function returns the number of non-null values with the same grouping field values

key value.

It is only available for numeric attributes.