Article

DAX Language - CALCULATE Function


A-Badde | Posted on April 08, 20

CALCULATE Function

 Description:

The CALCULATE function evaluates an expression in a context that is modified by the specified filters.

 Return Value:

CALCULATE returns a single value, that is the result of the expression.

 Syntax:

CALCULATE( <expression> , <filter1> , <filter2>…)  
  • Description of the parameters:

 

PARAMETER

DESCRIPTION

expression

The expression to be evaluated

filter

list of Boolean expression or a table expression that defines a filter

 

 Example:

  The following example creates a measure that calculates the Sales Amount during working days.

  For the expression argument, we will calculate the sum of sales using the SUM function, then we will add to the CALCULATE function two filter arguments to modify the result of the sum keeping only the working days.

  WorkinDays_SalesAmount = 
            CALCULATE(
                SUM(Sales[SalesAmount]), 
                'Calendar'[DayOfWeekName] <> "Saturday", 
                'Calendar'[DayOfWeekName] <> "Sunday"
                )

 

The CALCULATE function changes the context in which the data is filtered.

If there is a filter applied to a column used in a filter argument, it will be removed and replaced by the the filter argument

 

Related Video:

 

 


(0) Comments

There is no comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Add to favorite
Categories
Recent Posts
DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More


DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More


DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More


DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More