CALCULATETABLE

The CALCULATETABLE function evaluates an expression that generates a table in a context modified by the filters passed as arguments.

Syntax

CALCULATETABLE(
    expression,
    filter1,
    filter2...
)

Parameters
  • expression: Expression to evaluate.
  • filter1, filter2...: Optional arguments. List of Boolean expressions or table expressions that define filters to apply to expression.
Returned value

The CALCULATETABLE function returns a table.

Additional Information

The expression used as the first argument must generate a table.

Filters that are Boolean expressions:

  • They cannot refer to measurements.
  • They cannot use nested CALCULATE functions.
  • They cannot use functions that scan a table or that return a table, including aggregate functions.

In any case, these filters can use functions that retrieve simple values or that return a scalar.

Examples

In this example we want to add the amounts for those sales made in 2003, for which we create an intermediate table filtered according to this criterion using the CALCULATETABLE function. Once created, we go through it with the SUMX function adding the SalesAmount field:

Sales 2003 =
    SUMX(
    CALCULATETABLE(Sales, 'Calendar'[Year]=2003),
    Sales[SalesAmount]
)

Related functions
Category
Filter
Submitted by admin on Sat, 01/05/2019 - 17:54