BBampaa

Lessons › Power BI

Power BI lesson

CALCULATE

Look at the store chart: both bars show 1,306. Whatever store is selected, this measure always shows Lagos.

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

Example

CALCULATE takes a measure and changes the filter it's worked out under:

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.
Lagos Revenue = CALCULATE([Total Revenue], Sales[Store] = "Lagos")
2. Write a measure for Abuja's revenue.
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 that counts the orders worth more than 100.
Big Orders = CALCULATE([Orders], 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