DAX CALCULATE Function

Last Updated: 03 Sep, 2026

What Is the CALCULATE Function in DAX?

CALCULATE() is the most important function in DAX — it modifies the filter context of an expression, enabling comparisons like sales in a specific region or sales excluding returns. It’s the foundation most advanced DAX formulas, including time intelligence, are built on.

What CALCULATE() Does

CALCULATE() takes a base expression and one or more filter arguments, and evaluates that expression under the modified filter context those arguments create — either adding new filters or overriding existing ones on the report.

CALCULATE() Syntax

CALCULATE(<expression>, <filter1>, <filter2>, …) — the first argument is the value to calculate, and every argument after it is a filter condition applied before that value is evaluated.

Measures vs. Calculated Columns, Recap

A measure — the kind of object CALCULATE() is almost always used inside — is a dynamic calculation computed on the fly based on the current filter context, and is not stored in the table. This is what lets a CALCULATE()-based measure recalculate correctly no matter what slicers or filters a report viewer applies.

Counting and Statistical Functions Alongside CALCULATE()

CALCULATE() is frequently paired with counting functions — COUNT(), COUNTROWS(), DISTINCTCOUNT() — to answer filtered counting questions, such as the distinct number of customers who bought in a specific region.

 

How to Write a CALCULATE() Measure in Power BI

This 6-step tutorial builds a filtered CALCULATE() measure from scratch, then shows how to override rather than add to an existing filter using ALL().

Prerequisites

  • Power BI Desktop with a Sales-style table loaded
  • A basic SUM()-based measure already created or ready to create

Steps

  • Create a base measure: Total Sales = SUM(Sales[Amount]).
  • Wrap it in CALCULATE with a filter: West Sales = CALCULATE([Total Sales], Sales[Region] = “West”).
  • Test against a table visual: Add both measures alongside a Region column to confirm West Sales only reflects the West row.
  • Try overriding an existing filter: All Regions Sales = CALCULATE([Total Sales], ALL(Sales[Region])) to ignore any region filter already applied.
  • Compare the two behaviors: Add a slicer on Region and watch how West Sales stays fixed while All Regions Sales ignores the slicer entirely.
  • Combine with a counting function if needed: Distinct West Customers = CALCULATE(DISTINCTCOUNT(Sales[CustomerID]), Sales[Region] = “West”).