Calculated Measures
Create Calculated Measures in DAX
What Are Calculated Measures in DAX?
In DAX, the term "calculated measure" (commonly just "measure") refers to a formula-based value that is calculated on the fly based on user interaction with visuals, filters, and slicers.
They are not stored in the data model they're computed dynamically when needed, making them ideal for performance and real-time analysis.
Key Characteristics of Measures
Feature | Description |
---|---|
Calculated at query time | Measures are evaluated when the user interacts with a report |
Use Filter Context | Respond to slicers, filters, rows/columns in visuals |
Not stored | No additional memory used for storage |
Optimized | Efficient for aggregations across large datasets |
Dynamic | Automatically recalculates as filters change |
Example of a Basic Measure
If you have a Sales
table with a Revenue
column:
Total Revenue = SUM(Sales[Revenue])
This measure returns the sum of revenue based on the current filter context (e.g., selected year, region, product).
More Advanced Examples
- Profit Margin:
Profit Margin = DIVIDE([Total Profit], [Total Revenue])
- Year-to-Date Sales:
YTD Sales = TOTALYTD(SUM(Sales[Revenue]), Dates[Date])
Measures vs. Calculated Columns
Feature | Calculated Measure | Calculated Column |
---|---|---|
Evaluation Context | Filter Context | Row Context |
When Calculated | At runtime | During data refresh |
Stored in Model | No | Yes |
Performance | High | Can slow large models |
Use in Visuals | KPIs, cards, charts | Filters, slicers, relationships |
When to Use Measures
Use measures when you want to:
- Show aggregated results (SUM, AVERAGE, COUNT, etc.)
- Build KPIs, cards, or charts
- Create context-aware calculations (e.g., Total Sales by Region)
- Keep your model efficient and lean
No questions available.