Calculated Columns
Add a brand-new column that is worked out from other columns — row by row.
What you will learn
- Create a calculated column
- Write a simple row-by-row formula
- Know when a column is the right tool
A new column from old columns
Sometimes the data you need is not in the file — but you can calculate it from columns that are. A calculated column adds a new column whose value is worked out for every single row.
Example: your Sales table has Amount but you also want each sale’s tax at 10%. You make a calculated column that multiplies Amount by 0.1 on every row.
How to add one
- In the Data view, click your Sales table.
- On the Table tools ribbon, click New Column.
- Type a formula in the bar that appears, then press Enter.
The formula language is called DAX (short for Data Analysis Expressions — Microsoft’s formula language for Power BI, a bit like Excel formulas but for whole tables). For a calculated column you write the new name, an equals sign, then how to compute it from other columns:
Tax = Sales[Amount] * 0.1Note: Output: A new column named Tax appears in the Sales table. If a row has Amount 1200, its Tax shows 120; a row with Amount 450 shows 45. The formula runs once per row, so every sale gets its own tax figure.
Columns can combine text too
Calculated columns are not only for maths. You can join text — for example, build a label that shows the product and region together:
Label = Sales[Product] & " - " & Sales[Region]Note: Output: For a row with Product Keyboard and Region North, the Label column shows “Keyboard - North”. The & symbol glues text pieces together, and the " - " is the separator in the middle.
Making a decision per row with IF
Calculated columns can also make a yes/no decision for each row using the DAX IF function. It reads as IF(test, value-if-true, value-if-false). For example, label every big sale so you can spot it later:
Size = IF(Sales[Amount] > 5000, "High", "Normal")Note: Output: Each row gets a Size of “High” or “Normal”. The Monitor row with Amount 8900 is over 5000, so it shows “High”; the Keyboard row with 1200 and the Mouse row with 450 are under 5000, so they show “Normal”. The IF test runs separately on every row, giving each sale its own label.
Tip: A calculated column is calculated once per row and stored in the table, so you can use it just like any normal column — drop it into a chart, a slicer or a table.
Watch out: Do not reach for a calculated column when you really want a total or average across many rows. Those summaries should be measures (next lesson), which are faster and adjust to filters.
Q. A calculated column computes its value…
✍️ Practice
- Add a calculated column
Tax = Sales[Amount] * 0.1and check a few rows. - Make a text column that joins two columns with the
&symbol.
🏠 Homework
- Create a calculated column that flags big sales, e.g. an IF that returns “High” when Amount is over 5000 and “Normal” otherwise.