When your data doesn't have the field you need, you build one. Calculated fields are new fields defined with a formula — profit ratios, categories, cleaned text. Chapter 3 introduced them; this chapter is the working toolkit of function categories and the crucial row-level-vs-aggregate distinction.
Beyond the raw fields
Right-click in the Data pane → Create Calculated Field, give it a name and a formula. It becomes a new field you can drag onto shelves like any other — reusable across the whole workbook.
Row-level vs aggregate
The most important distinction, mirroring Power BI's columns-vs-measures:
Row-level (computed per underlying row, then aggregated in the view):[Sales] - [Cost][Sales] * 0.9Aggregate (operates on the aggregated values):SUM([Sales]) - SUM([Cost])SUM([Profit]) / SUM([Sales]) ← a ratio must be aggregate!
Logical functions
IF [Sales] > 1000 THEN "High" ELSEIF [Sales] > 500 THEN "Mid" ELSE "Low" ENDCASE [Region]WHEN "North" THEN "Priority"ELSE "Standard"ENDIIF([Profit] < 0, "Loss", "Profit") -- shorthand for a simple 2-way IFZN([Value]) -- treat NULL as zero (Zero-if-Null)
String & date functions
-- StringsLEFT([Name], 3) UPPER([Name]) TRIM([Email])CONTAINS([Email], "@") SPLIT([Full Name], " ", 1)-- DatesDATEDIFF('day', [Order Date], [Ship Date])DATEPART('year', [Order Date])DATETRUNC('month', [Order Date]) -- bucket to month startTODAY()
Practice
Create a profit-ratio calculated field the correct (aggregate) way and confirm it's right at the grand total. Build a sales-band with IF/ELSEIF, extract a first name with SPLIT, and compute shipping days with DATEDIFF.
Key takeaways
- 01Calculated fields are new formula-defined fields, reusable across the workbook.
- 02Row-level calcs compute per row then aggregate; aggregate calcs operate on aggregated values.
- 03A ratio of measures must be aggregate: SUM(Profit)/SUM(Sales), never the row-level version.
- 04Logical: IF/ELSEIF/END, CASE, IIF, ZN (zero-if-null).
- 05String (LEFT/UPPER/SPLIT/CONTAINS) and date (DATEDIFF/DATEPART/DATETRUNC) functions reshape fields.
