CALCULATE
CALCULATE evaluates an expression under a modified filter context.
Syntax
CALCULATE(expression, filter1, filter2, …)
Example
North Sales :=
CALCULATE(
[Total Sales],
Sales[Region]=”North”
)
FILTER
FILTER returns a filtered table that can be used in a DAX calculation.
Example
High Value Sales :=
CALCULATE(
[Total Sales],
FILTER(
Sales,
Sales[Sales Amount] > 50000
)
)
ALL
ALL removes filters from a table or column.
Example
Total Sales All Products :=
CALCULATE(
[Total Sales],
ALL(Products[Product])
)
This can be used to compare selected product sales with total sales across all products.
Practice
Create measures for:
- North Sales
- High Value Sales
- Total Sales ignoring Product filter