Wednesday, May 22, 2019

CALCULATE DAX Function

CALCULATE DAX Function (Filter)

Evaluates an expression in a context modified by filters.

Syntax

CALCULATE ( <Expression> [, <Filter> [, <Filter> [, … ] ] ] )
PARAMETERATTRIBUTESDESCRIPTION
Expression
The expression to be evaluated.
FilterOptional
Repeatable
A boolean (True/False) expression or a table expression that defines a filter.

Return values

SCALAR A single value of any type.
The value is the result of the expression evaluated in a modified filter context.

Remarks

Every filter argument can be either a filter removal (such as ALL, ALLEXCEPT, ALLNOBLANKROW), a filter restore (ALLSELECTED), or a table expression returning a list of values for one or more columns or for an entire expanded table.
When a filter argument has the form of a predicate with a single column reference, the expression is embedded into a FILTER expression that filters all the values of the referenced column. For example, the predicate shown in the first expression is internally converted in the second expression.
1
2
3
4
5
6
7
8
9
10
11
12
CALCULATE (
    <expression>,
    table[column] = 10
)
 
CALCULATE (
    <expression>,
    FILTER (
        ALL ( table[column] ),
        table[column] = 10
    )
)

No comments:

Post a Comment