CALCULATETABLE
Gives the rows of a table expression, worked out under filters its other arguments add, remove or replace.
Group: Filter. Compatible with DAX.
Syntax
CALCULATETABLE ( <expression> [, <filter1>] [, <filter2>] … )
| Parameter | Type | Description |
|---|---|---|
expression | Table | The rows wanted: any table expression, worked out under the filters that follow. |
filter1 | Filter optional | A condition on columns of one table, a table, or a modifier such as ALL or KEEPFILTERS. |
filter2 | Filter optional, repeatable | More filters; all of them apply together. |
Returns
Table. The table expression's rows, worked out in the filter context the filters make.
Remarks
- It is
CALCULATEfor a table: the same kinds of filters, a condition replacing the filter on its column in the same way, and context transition in a row context. - The filters reach everything inside it, measures added with
ADDCOLUMNStoo. - A filter changes only the tables it can reach. A condition on Sales does not narrow Products, because the relationship filters from Products to Sales: all four products come back, each with the liters of the year picked.
Examples
The beers
EVALUATE
CALCULATETABLE ( VALUES ( Products[Product] ), Products[Category] = "Beer" )
ORDER BY Products[Product]
| Products[Product] |
|---|
| IPA |
| Lettøl |
| Pils |
Each product's liters in 2025
EVALUATE
CALCULATETABLE (
ADDCOLUMNS ( VALUES ( Products[Product] ), "Liters in 2025", [Liters sold] ),
YEAR ( Sales[Month] ) = 2025
)
ORDER BY Products[Product]
| Products[Product] | Liters in 2025 |
|---|---|
| Cider | 101510 |
| IPA | 110336 |
| Lettøl | 56630 |
| Pils | 334877 |