#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Module 5
5 min read

Measures

Create powerful DAX measures for dynamic calculations

What are Measures?

Measures Overview

Measures are dynamic calculations that respond to filters in real-time.

  • Calculated on-the-fly (not stored)
  • Automatically react to slicers and filters
  • The heart of Power BI analytics

How to Create

Creating Measure

  1. Click table in Fields pane
  2. Table Tools > New Measure
  3. Type your formula
  4. Press Enter

Basic Aggregations

FunctionExample
SUMTotal Sales = SUM(Sales[Amount])
AVERAGEAvg Order = AVERAGE(Sales[Amount])
COUNTOrders = COUNT(Sales[OrderID])
COUNTROWSTotal Rows = COUNTROWS(Sales)
DISTINCTCOUNTUnique Customers = DISTINCTCOUNT(Sales[CustomerID])

Filter Context

Filter Context

Measures change based on filters applied:

Filter AppliedResult
NoneShows total for all data
Product slicerShows total for that product
Date filterShows total for that period

This is what makes measures powerful!

CALCULATE Function

Most important DAX function - modifies filter context:

USA Sales = CALCULATE([Total Sales], Customers[Country] = "USA")

Remove all filters:

All Sales = CALCULATE([Total Sales], ALL(Sales))

Common Patterns

Percentage of Total

Sales % = DIVIDE(
    SUM(Sales[Amount]),
    CALCULATE(SUM(Sales[Amount]), ALL(Sales))
)

Safe Division

Margin = DIVIDE([Profit], [Revenue], 0)

Using Variables

Profit Margin =
VAR Revenue = SUM(Sales[Revenue])
VAR Cost = SUM(Sales[Cost])
RETURN DIVIDE(Revenue - Cost, Revenue)

Quick Tips

  • Always use DIVIDE() instead of / operator
  • Use VAR for complex formulas (cleaner + faster)
  • Format measures: Right-click > Format

Measures are the real power of DAX. Master SUM, AVERAGE, COUNT, and CALCULATE first.