Locked lesson.
About this lesson
In this module we will review several CALCULATE() functions that live in a real model, showing how they work and add value to our business intelligence.
Exercise files
Download this lesson’s exercise file. You can download source data files for the course from the resources section of your Lessons page.
The CALCULATE() function – Application - Completed.pbix441.5 KB
Quick reference
The CALCULATE() Function – Application
Creating measures for our sample model using CALCULATE().
When to use
You want to practice using the CALCULATE() function.
Instructions
Create a multi-row card and add the Sales $ measure
Create the following measures and add them to the multi-row card:
Single filter CALCULATE() measures
- Sales $ - Draft = CALCULATE([Sales $],Categories[Category]="Draft Beer")
- Sales $ - Btl Beer = CALCULATE([Sales $],Categories[Category]="Bottled Beer")
- Sales $ - Can Beer = CALCULATE([Sales $],Categories[Category]="Canned Beer")
Multi-column CALCULATE() measures
- Squintz Draft $ v1 = CALCULATE([Sales $],Locations[Location Name]="The Squintz",Categories[Category]="Draft Beer")
- Squintz Draft $ v2 = CALCULATE([Sales $ - Draft],Locations[Location Name]="The Squintz")
More complex CALCULATE() measures
- Sales $ - 1-4PM = CALCULATE([Sales $],Sales[Hour]>=13 && Sales[Hour]<=16)
- Sales $ - Beer v1 = CALCULATE([Sales $],Categories[Category]="Draft Beer"||Categories[Category]="Bottled Beer"||Categories[Category]="Canned Beer")
- Sales $ - Beer v2 = [Sales $ - Draft]+[Sales $ - Can Beer]+[ Sales $ - Btl Beer]
Hints & tips
- Building measures on measures allows complex logic without having to write super complex formulas
Lesson notes are only available for subscribers.