Calculated Columns
Create custom columns in your data model using DAX formulas.
Calculated Columns in DAX are custom columns that you create in your data model using DAX formulas. They are stored as part of the table, and the values are computed row by row based on existing data.
Key Characteristics of Calculated Columns
Feature | Description |
---|---|
Row Context | Each row is evaluated individually when the DAX expression is applied. |
Stored in Memory | Once created, calculated columns are stored in the model and increase the model size. |
Evaluated During Data Refresh | Calculations happen when the data is loaded or refreshed not at query time. |
Used Like Regular Columns | You can use them in visuals, slicers, filters, and even relationships. |
Example
Assume you have a Sales
table with columns Quantity
and Price
.
You can create a calculated column called TotalLineAmount
:
TotalLineAmount = Sales[Quantity] * Sales[Price]
Each row in the Sales
table will now have a new column that shows the total value for that row (quantity × price).
Calculated Columns vs. Measures:
Feature | Calculated Column | Measure |
---|---|---|
Stored in Table? | Yes | No |
Row Context | Used | Not by default |
Storage Impact | Uses memory | Calculated on the fly |
Use Case | Row-by-row logic (e.g., tax per product) | Aggregations (e.g., total revenue) |
When to Use Calculated Columns
Use a calculated column when:
- You need a column for filtering, sorting, or grouping
- You want to build relationships using a new field
- The calculation is row-dependent, not aggregate-based
No questions available.