Downloads
DAXFilter and contextIntermediate

CALCULATE

Evaluates an expression in a filter context that you change.

Syntax
CALCULATE(<expression> [, <filter> [, <filter> [, ...]]])

Returns: The value of the expression (a scalar).

What it does

CALCULATE evaluates a measure or expression after changing the filters that apply to it. A finance team uses it to ask questions such as "total sales for online orders only" or "company-wide sales, ignoring the store slicer." Almost every useful measure in a Power BI or Excel model is a CALCULATE somewhere, even when you do not type the word.

Syntax and arguments

All the filters are applied together. A Boolean filter on a column replaces any filter already on that column, unless you wrap it in KEEPFILTERS.

Example

Assume the measures Total Sales and Total Cost from the fundamentals page. The business wants online channel sales, whatever the rest of the page shows for channels.

Online Sales =
CALCULATE (
    [Total Sales],
    Channel[ChannelName] = "Online"
)

CALCULATE evaluates Total Sales with the channel filter set to Online. In a table with one row per store, each row shows that store's online sales. The Online filter replaces any channel slicer, so the figure stays online even when the user selects Store.

Example: a second use

A controller wants each store's online sales as a share of the company's total sales across all channels.

Online Share of Sales =
DIVIDE (
    [Online Sales],
    CALCULATE ( [Total Sales], REMOVEFILTERS ( Channel ) )
)

The denominator removes the channel filter and keeps every other filter on the page, such as the date and the store. The result is a percentage between 0 and 1 that formats well as a percent.

Things to watch

In business terms

CALCULATE answers every "this, but only..." question: a channel or region view, sales excluding returns, a fixed scenario set against actuals, or a total scoped to one legal entity. It sits behind most variance, budget and share-of-total measures in month-end and board reporting.

Related functions

All DAX functions · View as Markdown · DAX fundamentals