Measures and Implicit Measures
Measures are DAX calculations used to summarize data dynamically. They are essential for calculating total sales, profit, average order value, percentages, and key performance indicators in Power BI reports.
Power BI also provides implicit measures when you add suitable numeric columns to a visual and select an aggregation such as Sum, Average, Minimum, or Maximum. Understanding the difference helps you create flexible and maintainable reports.
Learning Objectives
- Understand explicit and implicit measures.
- Create measures using DAX.
- Use SUM, AVERAGE, DIVIDE, and other functions inside measures.
- Understand how filter context affects measure results.
- Format measures for currency, percentages, and whole numbers.
- Choose the appropriate calculation for a report visual.
1. What Is a Measure?
A measure is a calculation evaluated when it is used in a visual or query. Its result depends on the current filter context, including report slicers, visual fields, page filters, and relationships in the model.
For example, a Total Sales measure can display the overall sales amount in a Card visual. When a user selects a particular product, the same measure can show sales for that product.
2. What Is an Explicit Measure?
An explicit measure is created by writing a DAX formula using the New measure command. It can be reused across multiple visuals and provides control over the calculation and formatting.
Example: Total Sales
Total Sales =
SUM(Sales[SalesAmount])
Example: Total Quantity
Total Quantity =
SUM(Sales[Quantity])
Example: Average Sales
Average Sales =
AVERAGE(Sales[SalesAmount])
3. What Is an Implicit Measure?
An implicit measure is generated by Power BI when a user adds an aggregatable column to a visual and selects an aggregation. For example, a numeric SalesAmount column may be summarized by Sum or Average.
- Add a numeric column such as SalesAmount to a visual.
- Open its field menu in the visual's Build pane.
- Select Sum, Average, Minimum, Maximum, or another available aggregation.
- Power BI applies that aggregation to the visual.
4. Explicit Measures vs. Implicit Measures
| Feature | Explicit Measure | Implicit Measure |
|---|---|---|
| Creation | Created with a DAX formula. | Generated by selecting an aggregation for a column in a visual. |
| Reuse | Can be reused across multiple visuals. | Aggregation is configured in the visual. |
| Complex logic | Supports custom DAX expressions. | Generally suited to built-in aggregations. |
| Naming | Can be given a meaningful measure name. | Uses the column and aggregation label in the visual. |
| Best use | Reusable business calculations and KPIs. | Quick summaries during visual creation. |
5. Create a Total Sales Measure
Suppose your Sales table has a numeric column named SalesAmount. Create an explicit measure as follows.
Total Sales =
SUM(Sales[SalesAmount])
To create this measure:
- Select the Sales table in the Data or Fields pane.
- Select New measure from the ribbon or the table's context menu.
- Enter the formula in the formula bar.
- Press Enter.
- Add Total Sales to a Card visual.
6. Create a Profit Measure
If SalesAmount represents revenue and CostAmount represents total cost for each sales record, create the following measures.
Total Cost =
SUM(Sales[CostAmount])
Total Profit =
[Total Sales] - [Total Cost]
The Total Profit measure subtracts total cost from total sales in the current filter context.
7. Create a Profit Margin Measure
Profit margin measures the proportion of revenue retained as profit. Use DIVIDE to handle cases where total sales are zero or blank.
Profit Margin =
DIVIDE(
[Total Profit],
[Total Sales],
0
)
Select the Profit Margin measure and set its format to Percentage. You can choose the number of decimal places in the measure formatting options.
8. Understand Filter Context
A measure responds to the context in which it is evaluated. A Card visual may display total sales for all selected records, while a table visual may display sales separately for each product.
Sales for Electronics =
CALCULATE(
[Total Sales],
Sales[Category] = "Electronics"
)
This example assumes the Sales table contains a Category column. CALCULATE applies the Electronics condition when evaluating Total Sales.
9. Common Aggregations in Power BI
| Aggregation | Purpose | Example Question |
|---|---|---|
| Sum | Adds numeric values. | What are the total sales? |
| Average | Calculates the arithmetic mean. | What is the average sales amount? |
| Minimum | Returns the smallest value. | What is the lowest order value? |
| Maximum | Returns the largest value. | What is the highest sales amount? |
| Count | Counts values according to the selected aggregation. | How many nonblank values are present? |
| Count distinct | Counts unique values in a column. | How many unique customers purchased products? |
10. Format Measures Correctly
Correct formatting helps users interpret results without confusion. Select a measure in the model and choose an appropriate format.
- Total Sales: Currency or decimal number.
- Total Quantity: Whole number.
- Profit Margin: Percentage.
- Average Sales: Currency or decimal number.
- Customer Count: Whole number.
11. Student Practice Tasks
Task 1: Create an explicit measure named Total Sales.
Task 2: Create Total Quantity and Average Sales measures.
Task 3: Create Total Cost and Total Profit measures.
Task 4: Create a Profit Margin measure using DIVIDE.
Task 5: Add SalesAmount to a visual and test the available implicit aggregations.
Task 6: Display Total Sales in a Card visual and Sales by Product in a table.
Task 7: Add a Category slicer and observe how the measures respond.
Task 8: Format each measure using the correct number format.
12. Knowledge Check
Question 1: What is an explicit measure?
Answer: A reusable calculation created by writing a DAX formula.
Question 2: What is an implicit measure?
Answer: An aggregation applied to a column within a visual.
Question 3: Which function can safely divide two measure results?
Answer: DIVIDE().
Question 4: Why can a measure return different values in different visuals?
Answer: Because the filter context may differ between the visuals.
Question 5: Which format is appropriate for Profit Margin?
Answer: Percentage.
Summary
In this lesson, you learned how explicit measures use DAX formulas to calculate reusable business metrics and how implicit measures provide quick aggregations directly within report visuals.
You practised creating Total Sales, Total Cost, Total Profit, and Profit Margin measures. You also learned how filter context affects measure results and why correct formatting is important. Use explicit measures for reusable business logic and verify every calculation against the data model before publishing a report.