Locked lesson.
About this lesson
In this module we'll explore how to use Power BI's formula language to create re-usable "Measures"
Exercise files
There are no related exercise files for this lesson.
Quick reference
Basic Measures – Theory
How and why you should create explicit measures in Power BI.
When to use
When you want to begin writing basic DAX measures for Power BI.
Instructions
Advantages of explicitly writing your own formulas in Power BI
- You can provide discoverable names for your measures (instead of “Sum of Sales”)
- You can provide default formatting for your measures (no dollar signs and no decimals)
- You can reuse the measure and update all visuals at once if you make a change
- Adds security by preventing users from drilling in to records underlying the visual
To create a measure
- Right click the table name on the Fields window -> New Measure
- Write your measure in the following format:
- Measure Name = FUNCTION(TableName[ColumnName])
Managing measures
- Select the measure name in the Fields window
- Go to the Modeling tab to display the formula bar with the measure formula
Helpful functions
- COUNT(Table[Column])
- COUNTA(Table[Column])
- DISTINCTCOUNT(Table[Column])
- COUNTROWS(Table)
- SUM(Table[Column])
- MAX(Table[Column])
- MIN(Table[Column])
- AVERAGE(Table[Column])
- Note that this is not an exhaustive list, there are many more
Hints & tips
- Avoid using the New Measure on the modeling tab, as it may not put it in the correct table
- There is a search function in the Fields window if you can’t find a measure
Login to download
Lesson notes are only available for subscribers.