Module 9 · Power BI Fundamentals
Measures with CALCULATE and time intelligence
Change the filter context with CALCULATE, build percentage-of-total, year-to-date and year-on-year measures.
About 45 minutes
The problem
The managing director wants three numbers on every page: revenue this year to date, growth versus the same period last year, and each category's share of revenue. None of these is a plain sum. Each needs a measure that changes the filters before calculating.
The concept
CALCULATE evaluates an expression under modified filters:
DAX
CALCULATE ( <expression>, <filter1>, <filter2>, … )DAX
Revenue Lagos = CALCULATE ( [Revenue], customers[region] = "Lagos" )That measure shows Lagos revenue even in a visual sliced by another region: the filter argument replaces the region filter.
Removing filters: ALL / REMOVEFILTERS
DAX
Revenue All Categories = CALCULATE ( [Revenue], REMOVEFILTERS ( products[category] ) )
% of Revenue = DIVIDE ( [Revenue], [Revenue All Categories] )In a table by category, the first measure ignores the category on each row, giving the grand total, so the ratio is each category's share. Format % of Revenue as a percentage.
Time intelligence (needs the marked date table from lesson 7):
DAX
Revenue YTD = TOTALYTD ( [Revenue], 'Date'[Date] )
Revenue LY = CALCULATE ( [Revenue], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
YoY % = DIVIDE ( [Revenue] - [Revenue LY], [Revenue LY] )TOTALYTDadds everything from 1 January up to the latest date in the current filter.SAMEPERIODLASTYEARshifts the dates in the filter back one year.YoY %compares them; blank when there's no previous year.
Example
A matrix with Date[Year] and Date[Month] in Rows:
| Month | Revenue | Revenue LY | YoY % |
|---|---|---|---|
| 2026 Jan | 48,963,925 | 37,088,460 | 32.0% |
| 2026 Feb | 43,042,730 | 36,138,690 | 19.1% |
| 2026 Mar | 51,202,475 | 46,282,170 | 10.6% |
And Revenue YTD at 2026 March shows Q1 2026 in total.
Walkthrough
- In
_Measures, addRevenue All Categoriesand% of Revenue. Build a table:products[category],[Revenue],[% of Revenue]. - Add
Revenue YTD,Revenue LYandYoY %. Format YoY % as a percentage with one decimal place. - Build a matrix with
Date[Year]→Date[Month]in Rows and the three measures in Values. - Check one number by hand: February 2026's YoY % should equal (43.04 − 36.14) ÷ 36.14.
- Add a Card for
Revenue YTDand a slicer onDate[Month]: selecting March 2026 shows year-to-date March.
Practice
Practice
What share of total revenue (all dates) comes from Beverages? One decimal place.
Practice
What is Revenue YTD at the end of March 2026, to the nearest naira?
Challenge
Challenge · optional
What is YoY % for Q1 2026 against Q1 2025, to one decimal place?
Check your understanding
Answer every question to check.