Open In App

Power BI – How to Create Calculated Measures?

Last Updated : 16 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

A measure is a calculation that can be applied to any visual. We can use all aggregation operations like sum, average, min, and max to create measures using DAX (data analysis expressions). After creating a measure, it will not be saved in the dataset; it is simply a calculation, which will appear in “Fields” with the calculator symbol.

Dataset

The dataset contains data on Titanic passengers. The data indicates whether or not the passenger survived. and include information such as passenger id, passenger name, age, gender, ticket fare, and whether or not the passenger survived. 

Note: Prior knowledge, such as loading datasets into Power BI Desktop and understanding basic DAX functions, is required.

The dataset used in this article can be found here. Here we will create a measure for the average fare of a ticket. A few steps must be taken in order to calculate the measure. 

Steps to Create Calculated Measures

  • Open Power BI Desktop and load the dataset.
  • Navigate to the Home Menu, which can be found at the top left of the screen. 
Navigating-home

 

  • Now, on the right side of the home menu, under “Calculations,” click “New Measure.” 
Clicking-new-measure

 

  • After clicking on “New Measure,” the formula bar is shown between the Menu and Report views.
Formula-bar-opens

 

  • Now let us rename the measure to our requirement, in this case, “AverageFare.”
Renaming-measure

 

  •  It is now time to start writing DAX (data analysis expressions) in the formula bar. After writing DAX, click on the correct symbol, which is present just to the left of the formula bar.
Writing-DAX-formula

 

Measure name = Aggregation function(‘tablename'[column name])

In this case, we used the average function to determine the average ticket price.

  • That’s how simple it is. A measure is created, and we can find calculated measures in the “Fields” on the right side of the screen.
New-measure-created

 

  • Now it’s time to visualize the calculated measure. To visualize, I am using this card visualization.
Visualizing-calculated-measure

 

  • After selecting, you can see an empty card on the report view.
Report-card-added

 

  • Now select the check box next to the calculated measure, which is “AverageFare,” in the Fields.
Selecting-field

 

  • Now you can see the result.
Report-card-created

 

Conclusion

The average fare is $32.2 USD.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads