---
type: learning
area: learning
status: learning
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - learning
---
![[img-20250704-133014-5b41a148.png]]
- Example
![[img-20250704-133721-36d94ff4.png]]
## Error Handling

![[img-20250704-231512-6b5f6e67.png]]

## Variables
![[img-20250704-233948-28a7e27f.png]]

![[img-20250704-235136-15ae3973.png]]
Variables cannot be modified after (cannot be filtred)

### 🧠 **How `CALCULATE` evaluates its parameters in DAX**

The `CALCULATE` function is **special** because:

- It **changes the filter context**.
    
- It evaluates filters in a **specific order**.
    

---

✅ **Evaluation Order of Parameters:**

1. **The expression (1st parameter)** is evaluated _last_.
    
    - The filters are applied **first** to modify the context.
        
    - Then the expression is evaluated _inside_ the new context.
        
2. **Filter arguments (2nd, 3rd, …)** are evaluated _first_, and applied **sequentially**.
    
    - Each filter modifies the filter context.
        
    - If multiple filters affect the **same column**, the **last filter overrides the earlier ones**.

``` dax
CALCULATE(
    SUM(Sales[Amount]),                     -- expression
    Sales[Region] = "West",                 -- filter 1
    Sales[Year] = 2024                      -- filter 2
)
```

✔ Step 1: Evaluate Sales[Region] = "West" → Filter context now includes only Region = West.
✔ Step 2: Evaluate Sales[Year] = 2024 → Filter context now includes only Year = 2024.
✔ Step 3: Evaluate SUM(Sales[Amount]) within the modified filter context.