Article

DAX Language - CALCULATE Function

DAX Language - CALCULATE Function


A.Baddane | Posted on April 08, 21

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
Add to favorite
Categories
Recent Posts
Filter column based on a list in Power Query
A.Baddane | April 05, 23

Sometimes when you work within power query, you need to filt...Read More


Use HTML in Power BI - Part 2
A.Baddane | July 05, 22

In the first blog post about using HTML in Power BI Desktop,...Read More


Use HTML in Power BI
A.Baddane | Feb. 21, 22

In this blog post, I will show you how to use HTML to create...Read More


Covid-19 Report
A.Baddane | Nov. 23, 21

The COVID-19 pandemic, also known as the coronavirus pandemi...Read More