Calculated Columns vs. Measures
Swipe to show menu
DAX offers two types of calculations inside Power Pivot: measures, which live in the calculation area, and calculated columns, which live inside a table. Both use DAX syntax and both are stored in the data model rather than in the Excel workbook.
The Calculated Column Example
Let's build a Price Band column that assigns each product a label — Low, Mid, or High — based on its unit price. This is a row-level label: every product has its own price band determined by its own unit price.
= IF(Products[Unit Price] < 100, "Low", IF(Products[Unit Price] < 500, "Mid", "High"))
Key Points:
- No measure name or
:=— calculated columns start with=like an Excel formula. The column name is set by renaming the header after the formula is entered; - Column reference syntax —
Products[Unit Price]— the same table and column syntax used in DAX measures. No cell addresses; - Two closing brackets — one bracket closes the inner IF, one closes the outer. A common source of formula errors.
DAX does not have an IFS function — only IF. When more than two outcomes are needed, IF functions must be nested, with each false branch leading into the next condition.
Task
Step 1 — Add two calculated columns
-
Open the workbook. Go to Power Pivot → Manage → Data View;
-
Calculated column 1 —
Order Size(Sales table); -
Click the Sales tab. Add a calculated column at the far right of the table using the following formula:
= IF(Sales[Quantity] >= 4, "Large", "Small") -
Rename the column
Order Size; -
Scroll through the column and confirm that rows with Quantity of
4or more showLargeand rows with Quantity of3or fewer showSmall; -
Calculated column 2 —
Customer Tier(Customers table); -
Click the
Customerstab. Add a calculated column using the following formula:= IF(Customers[Segment] = "Enterprise", "Tier 1", IF(Customers[Segment] = "SMB", "Tier 2", "Tier 3")) -
Rename the column
Customer Tier; -
Scroll through the column and confirm that
Enterprisecustomers showTier 1,SMBcustomers showTier 2, andStartupcustomers showTier 3.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat