Skip to main content
Albero Academy

Writing Measures

Build KPIs, ratios and conditional calculations.

DAX9 min

Real reports need more than a plain SUM — ratios, KPIs, and calculations built on other measures. Measures can reference each other, which keeps complex logic readable and maintainable.

Building on measures

measures reference measures
Total Sales = SUM(Sales[Amount])
Total Cost = SUM(Sales[Cost])
Profit = [Total Sales] - [Total Cost]
Profit Margin = DIVIDE([Profit], [Total Sales]) -- safe divide (no /0 error)

Useful patterns

common measure functions
Distinct Customers = DISTINCTCOUNT(Sales[CustomerID])
Big Deals = COUNTROWS(FILTER(Sales, Sales[Amount] > 100000))
Status = IF([Profit Margin] > 0.2, "Healthy", "Review")

Key takeaways

  1. 01Measures can reference other measures — build complex logic from simple named pieces.
  2. 02DIVIDE(a, b) is the safe division (handles divide-by-zero); use it over /.
  3. 03DISTINCTCOUNT, FILTER, IF and CALCULATE cover most measure needs.
  4. 04Composing measures keeps logic readable and fixable in one place.

Finished this chapter?

Mark it complete to track your progress through Power BI.