Wyn Enterprise User Guide

Aggregation Functions

This function helps in calculating a (scalar) value such as count, sum, average, minimum, or maximum for all rows in a column or table as defined by the expression.

Following is the list of aggregation functions supported in Wyn Enterprise:

AVERAGE


Description

The AVERAGE function returns the average (arithmetic mean) of all the numbers in a column.

Syntax

AVERAGE(<column>)

Parameters

Parameter Description
column The column contains the numbers for which you want the average.

Return Value

A decimal number.

Example

AVERAGE('Sale'[Price])

AVERAGEX


Description

The AVERAGEX function calculates the average (arithmetic mean) of a set of expressions evaluated over a table.

Syntax

AVERAGEX(<table>,<expression>)

Parameters

Parameter Description
table Name of the table, or an expression that specifies the table over which the aggregation can be performed.
expression An expression with a scalar result, which will be evaluated for each row of the table in the first argument.

Return Value

A decimal number.

Example

AVERAGEX('Sale','Sale'[Price])

COUNT


Description

The COUNT function counts the number of cells in a column that contain non-blank values.

Syntax

COUNT(<column>)

Parameters

Parameter Description
column The column that contains the values to be counted.

Return Value

A whole number.

Example

COUNT('Product'[Name])

COUNTROWS


Description

The COUNTROWS function counts the number of rows in the specified table, or a table defined by an expression.

Syntax

COUNTROWS(<table>)

Parameters

Parameter Description
table The name of the table that contains the rows to be counted, or an expression that returns a table.

Return Value

A whole number.

Example

COUNTROWS('Product')

COUNTX


Description

The COUNTX function counts the number of rows that contain a non-blank value or an expression that evaluates to a non-blank value when evaluating an expression over a table.

Syntax

COUNTX(<table>,<expression>)

Parameters

Parameter Description
table The table containing the rows to be counted.
expression An expression that returns the set of values that contains the values you want to count.

Return Value

An integer.

Example

COUNTX('Product','Product'[Name])

DISTINCTCOUNT


Description

The DISTINCTCOUNT function counts the number of distinct values in a column.

Syntax

DISTINCTCOUNT(<column>)

Parameters

Parameter Description
column The column that contains the values to be counted.

Return Value

The number of distinct values in the column.

Example

DISTINCTCOUNT('Product'[Name])

DISTINCTCOUNTX


Description

The DISTINCTCOUNTX function counts the number of rows that contain a non-blank distinct value or an expression that evaluates to a non-blank distinct value when evaluating an expression over a table.

Syntax

DISTINCTCOUNTX(<table>,<expression>)

Parameters

Parameter Description
table The table containing the rows to be counted.
expression An expression that returns the set of values that contains the values you want to count.

Return Value

The number of distinct values in the column.

Example

DISTINCTCOUNTX('Product','Product'[Name])

MAX


Description

The MAX function returns the largest value in a column, or between two scalar expressions.

Syntax

MAX(<column>)

Parameters

Parameter Description
column The column in which you want to find the largest value.

Return Value

The largest value.

Example

MAX('Sale'[Price])

MAXX


Description

The MAXX function evaluates an expression for each row of a table and returns the largest value.

Syntax

MAXX(<table>,<expression>)

Parameters

Parameter Description
table The table contains the rows for which the expression will be evaluated.
expression The expression to be evaluated for each row of the table.

Return Value

The largest value.

Example

MAXX('Sale','Sale'[Price])

MIN


Description

The MIN function returns the smallest value in a column, or between two scalar expressions.

Syntax

MIN(<column>)

Parameters

Parameter Description
column The column in which you want to find the largest value.

Return Value

The smallest value.

Example

MIN('Sale'[Price])

MINX


Description

The MIN function returns the smallest value that results from evaluating an expression for each row of a table.

Syntax

MINX(<table>,<expression>)

Parameters

Parameter Description
table The table contains the rows for which the expression will be evaluated.
expression The expression is to be evaluated for each row of the table.

Return Value

The smallest value.

Example

MINX('Sale','Sale'[Price])

SUM


Description

The SUM function adds all the numbers in a column.

Syntax

SUM(<column>)

Parameters

Parameter Description
column The column contains the numbers to sum.

Return Value

A decimal number.

Example

SUM('Sale'[Price])

SUMX


Description

The SUMX function returns the sum of an expression evaluated for each row in a table.

Syntax

SUMX(<table>,<expression>)

Parameters

Parameter Description
table The table contains the rows for which the expression will be evaluated.
expression The expression is to be evaluated for each row of the table.

Return Value

A decimal number.

Example

SUMX('Sale','Sale'[Price])