BBampaa

Lessons › Power BI

Power BI lesson

CALCULATE

Both store bars show 1,306: this measure always means Lagos, whichever store you pick.

Try this lesson free →
About 5–10 minutes · no sign-up needed

Example

CALCULATE works out a measure for just some of the rows. This one is Total Revenue, but only where the store is Lagos:

Lagos Revenue = CALCULATE([Total Revenue], Sales[Store] = "Lagos")

Key points

CALCULATE(Work out a measure under a different filter.
[Total Revenue],First, the measure to work out.
Sales[Store] = "Lagos"Then the filter. Text goes in quotes. Numbers can use > or <, like Sales[Revenue] > 100.

Same shape every time: CALCULATE([Measure], Table[Column] = "value").

In Power BI Desktop

CALCULATE goes in the same formula bar. Type Sales[ and Power BI suggests the columns.

Practice

Try each one in your head first, then open the answer.

1. Build the formula for Lagos Revenue: revenue from the Lagos store.
Lagos Revenue = CALCULATE([Total Revenue], Sales[Store] = "Lagos")
2. Write a measure for the revenue of the Abuja store.
Abuja Revenue = CALCULATE([Total Revenue], Sales[Store] = "Abuja")
3. Write a measure for revenue from the Audio category.
Audio Revenue = CALCULATE([Total Revenue], Products[Category] = "Audio")
4. Write a measure for orders with revenue over 100.
Big Orders = CALCULATE([Orders], Sales[Revenue] > 100)
5. Write a measure for Lagos revenue from sales over 100.
Lagos Big Revenue = CALCULATE([Total Revenue], Sales[Store] = "Lagos", Sales[Revenue] > 100)

Learn it by doing. This lesson is a short hands-on level on Bampaa: see it work, then build and write it yourself, with instant feedback.

Try this lesson free →
About 5–10 minutes · no sign-up needed