How to Create a Measure in Power BI?

Do you know how to create a measure in Power BI? OK, no problem!

In this Power BI tutorial, I will explain what a Power BI measure is, how to create a measure in Power BI, how to use measures in Power BI, and how to edit a measure in Power BI.

Also, I will tell you how to create a Power BI automatic measure and use measures in other measures in Power BI with various examples.

What is Measure in Power BI

The measure is a calculated or formula field in Power BI created using the DAX (Data Analysis Expression) language. Based on our required measure, it performs a real-time calculation.

For example, if you have a sales dataset, you might create a measure to calculate the total sales, average sales per month, or profit margin.

When we create a measure in the Power BI Desktop, it is displayed in the Data Panel fields list with a calculated icon. We can add them to a new or existing visualization.

How to Create a Measure in Power BI

I have created a Total Sales measure, the sum of sales formula.

How to Create a Measure in Power BI

We can create our Measure using the Data Analysis Expression (DAX) in Power BI Desktop. There are 250 DAX functions available in Power BI.

Here, I have a SharePoint list (Supermart) that contains below columns with various data types:

ColumnsData Types
Order IDSingle line of text
Customer NameSingle line of text
StateSingle line of text
Product NameSingle line of text
SalesCurrency
ProfitCurrency
QuantityNumber
Create a Measure in Power BI

Let’s create our measure by following the step-by-step process:

1. I hope you open Power BI and load the data set.

Measure in Power BI Desktop

2. In the Data Panel, right-click Supermart or click on the More options (…) -> New measure.

How to Create a Measure in Power BI

Also, we can create a measure by clicking the Home tab -> Click New measure under the Calculation section.

New Measure in power BI

3. In the formula bar, we will put the DAX expression for total sales.

In Power BI create a measure
Total sales = SUM(Supermart[Sales])

Where:

  • Total sales = Name of the new measure.
  • SUM = DAX function.
  • Supermart = Name of the data set table.
  • Sales = Column name of the table.

4. The new measure is added to the Data panel after clicking the commit button.

How to Create a Measure in Power BI

Using the above steps, you can create a new measure in the Power BI Desktop.

How to Use Measures in Power BI

After creating our measure, I will show you how to use measure in Power BI Desktop.

To do this, We will create a visual on Power BI Desktop to use this measure. For example, we will create a column chart to use this measure.

1. Select a Stacked column chart under the visualization panel.

How to use measures in Power BI

2. Then drag the Product Name into the X-axis and Total sales into the Y-axis. Check the screenshot below.

use measures in Power BI

In this way, you can use measures in Power BI Desktop.

How to Edit a Measure in Power BI

Now, we see how to edit a measure in Power BI.

In the example mentioned above, where we created a Total sales measure, if you want to change the measure to Average Sales, follow the steps below.

1. Under the Data pane, Select Total sales measure (You can select the measure you want to edit).

power bi edit measure

2. Afterward, you can see the formula bar under the Measure tools tab.

how to edit a measure in power bi

3. Then edit your measure. In my case, I change SUM to AVERAGE.

Average Sales = AVERAGE(Supermart[Sales])

Where:

  • Average sales = Name of the new measure.
  • AVERAGE = DAX function.
  • Supermart = Name of the data set table.
  • Sales = Column name of the table.
how to edit measure in power bi

4. Click the Commit button (left side of the formula bar).

how to edit quick measure in power bi

5. After changing Total Sales to Average Sales, our Stacked Column Chart looks like this:

Power BI Conditional Formatting Based on Measure

Using this method, you can edit any measure in Power BI.

Automatic Measures in Power BI

Now, I will show how Power BI creates automatic measures. Follow these steps:

1. Open the Power BI desktop and load the data set [Supermart].

Measure in Power BI Desktop

2. Let’s create a visual using data from the Data panel. Here I will create a column visual using Sales.

Automatic measure in Power BI

In Power BI, you can create automatic measures to aggregate numeric column data. The default aggregation for a numeric datatype is Sum, but we can change it to average, minimum, maximum, count, median, etc.

3. To change the aggregate, select the visual -> In the Value area, click the down arrow to the right of Sales.

measures in power bi examples

4. The default aggregate of a numeric datatype is Sum. As I say in the above we can change it by click. For example, if we change the measures from Sum to Average.

Automatic Measures available in Power BI

This is how you can use automatic Measures in Power BI Desktop.

Use Measure in Another Measure in Power BI

We can also use an existing measure to create a new measure. For example, let’s create a measure that calculates the Net Sale.

1. Goto Home tab -> Calculation Group -> New measure.

New Measure in power BI

2. Enter this DAX expression to create a new Measure for Net Sales.

Net sales = SUM(Supermart[Profit]) + [Total sales]

Click Commit to calculate and save the measure in the Data panel.

Use measure in another measure in Power BI

Where:

  • Net sales = Name of the new measure.
  • SUM = DAX function.
  • Supermart = Name of the data set table.
  • Profit = Column name of the table.
  • Total sales = Previous created Measure.
Measure in Another Measure in Power BI

3. Now, we can use Net sales to create a new or existing visualization.

Use Measure in another Measure

This is a way to use Measure in another Measure.

Conclusion

In this Power BI tutorial, we explored Measures in Power BI, covering topics such as What is a Power BI Measure, how to create a measure in Power BI, how to edit a measure in Power BI, and Automatic Measures in Power BI.

Also, we saw how to use measures in Power BI, and utilizing measures within other measures in Power BI with different examples.

Moreover, you may like some more Power BI tutorials: