[{"id":"355cee34-a92a-441e-94ae-0188c18b1c19","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"26713f3d-fbf1-4c9c-bdbe-31fb188e7096","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"ec2f4855-5e5b-4d97-8017-54b119e4bcd8","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"21c749ac-6a80-4731-ac3b-597990e79038","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"a64d445f-5e12-4939-999f-7ecbd70978c5","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"af5bd81a-b6cd-410b-84b4-9de9c51c3a7d","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"769a3d2b-eedc-4d98-9641-d9cd653b2575","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"8fd79227-699c-46d8-af09-dec8b91f6e90","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"86b2a642-0ee8-4605-b04d-e7e0ec019e01","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]}]

To include summary values in a report, you can use aggregate functions described below. All of them have the optional `scope`

argument that determines the set of data to use for the calculation. The `scope`

argument could have one of the following values.

The name of a data set

The name of a data region

The name of a group, such as a Table Group

By default, the value of a `scope`

argument is the current scope that depends on a report item that "hosts" the aggregate function. For example, in the Get Started with Tabular Reports demo, the table's group footer has the textbox that shows the `{Sum(unitsInStock)}`

value. This is the call to the `Sum`

aggregate function and the `scope`

argument is omitted. It means that the calculation scope is the group instance. If a textbox with the same value resides in the table header instead, the calculation scope is the entire table.

Another optional argument of some aggregate functions is `recursive`

that should be set to `Recursive`

if you want to display summaries that include values from child groups in a recursive hierarchy. For example, the Interactive Hierarchy demo uses the `{Sum(EmployeeCount, "EntityKey", "Recursive")}`

expression to display the cumulative Employee Count for cities, regions, and countries.

Returns a conditional aggregated value of values specified by the expression, calculated in the specified scope.

**Syntax**

AggregateIf(`condition`

, `aggregate`

, `expression`

, [`scope`

])

**Arguments**

`condition`

- the expression that evaluates to a boolean value indicating whether to include the`expression`

into the calculation`aggregate`

- the name of the aggregate function to use for calculation, for example,`Count`

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope

**Examples**

You can use the following expression to return the sum of the `SalesAmount`

field values within the current scope. The result only includes SalesAmount values that are greater than 1000.

`{AggregateIf(SalesAmount > 1000, "Sum", SalesAmount)}`

Returns the average of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Avg(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the average of `SalesCount`

field values within the current scope.

`{Avg(SalesCount)}`

Returns a count of non-null values specified by the expression, calculated in the specified scope.

**Syntax**

Count(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the number of `UnitsOnOrder`

field values within the `ProductsTable`

data region.

`{Count(UnitsOnOrder, "ProductsTable")}`

Returns a number of distinct non-null values specified by the expression, calculated in the specified scope.

**Syntax**

CountDistinct(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the number of distinct `CustomerId`

field values within the current scope.

`{CountDistinct(CustomerId)}`

Returns a number of rows within the specified scope.

**Syntax**

CountRows([`scope`

], [`recursive`

])

**Arguments**

`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the number of rows within the current scope.

`{CountRows()}`

Returns the sum of distinct non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

DistinctSum(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the sum of distinct `Size`

field values within the current scope.

`{DistinctSum(Size)}`

Returns the first value of the specified expression, calculated in the specified scope.

**Syntax**

First(`expression`

, [`scope`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope

**Examples**

You can use the following expression to return the first value of the `ProductName`

field in the `ProductsTable`

data region.

`{First(ProductName, "ProductsTable")}`

Returns the last value of the specified expression, calculated in the specified scope.

**Syntax**

Last(`expression`

, [`scope`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope

**Examples**

You can use the following expression to return the last value of the `SalesAmount`

field in the current scope.

`{Last(SalesAmount)}`

Returns the maximum value of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Max(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the maximum value of `Size`

field values within the current scope.

`{Max(Size)}`

Returns the median of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Median(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the median of `SalesAmount`

field values within the `Sales`

data region.

`{Median(SalesAmount, "Sales")}`

Returns the minimum value of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Min(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the minimum value of `Size`

field values within the current scope.

`{Min(Size)}`

Returns the value that appears most often among values specified by the expression, calculated in the specified scope.

**Syntax**

Mode(`expression`

, [`scope`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope

**Examples**

You can use the following expression to return the most often value among values of the `ReturnReason`

field within the current scope.

`{Mode(ReturnReason)}`

Returns a running aggregate of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

RunningValue(`expression`

, `aggregate`

, [`scope`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`aggregate`

- the name of the aggregate function to use for calculation, for example,`Count`

`scope`

- the optional calculation scope

**Examples**

You can use the following expression to return the running value of the sum of the `SalesAmount`

field values within the current scope.

`{RunningValue(SalesAmount, "Sum")}`

Returns the standard deviation of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

StDev(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the standard deviation of the `ReturnAmount`

field values within the current scope.

`{StDev(ReturnAmount)}`

Returns the population standard deviation of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

StDevP(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the population standard deviation of `ReturnAmount`

field values within the current scope.

`{StDevP(ReturnAmount)}`

Returns the sum of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Sum(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the sum of `SalesAmount`

field values within the current scope.

`{Sum(SalesAmount)}`

Returns the variance of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

Var(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the variance of the `ReturnAmount`

field values within the current scope.

`{Var(ReturnAmount)}`

Returns the population variance of non-null numeric values specified by the expression, calculated in the specified scope.

**Syntax**

VarP(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the population variance of `ReturnAmount`

field values within the current scope.

`{VarP(ReturnAmount)}`

Returns an Array containing the values of the specified expression.

**Syntax**

ToArray(`expression`

, [`scope`

], [`recursive`

])

**Arguments**

`expression`

- the expression on which to calculate the summary value`scope`

- the optional calculation scope`recursive`

- the optional`Recursive`

value indicating whether to perform the calculation recursively

**Examples**

You can use the following expression to return the `ProductName`

field values separated by a comma within the current scope.

`{Join(ToArray(ProductName), " ,")}`

Submit and view feedback for