How to Create a Measure in Power BI and Check That It Works

Highlighted data rows feed a single Power BI measure that can be reused in a visual.

In Power BI Desktop, select the table where you want the measure to appear, choose New measure, and enter a DAX expression. A measure recalculates for the filters in the report, so you can use the same sales measure in a total, a regional comparison, and a monthly trend.

Start with the question the measure should answer

Suppose the finance team wants to know total sales for whichever region and month it selects. First, agree on the amount that counts as sales. If the source has gross and net amounts, pick the one that agrees with the ledger and use a name that makes the difference clear.

For the simplest example, assume each row of your Sales table has one numeric Sales Amount. Before writing DAX, pick a small period and confirm the expected total by checking the source. That gives you a number you can trust when you build the visual.

Create the measure in Power BI Desktop

Select the Sales table and choose New measure. Give the measure a clear name and enter this expression:

Total Sales = SUM ( Sales[Sales Amount] )

Select the measure and set its format to match the data, such as currency with the appropriate decimal places. Formatting changes the way the number displays while keeping the underlying value available for analysis. If other report authors use the model, a clear name and description help them choose the right measure.

Show it at two levels of detail

Add Total Sales to a card. Check the amount for the small period you reconciled. Then put Region and Total Sales in a table visual. If you use a separate region table, check that it is related to Sales in the model.

Select one region in a slicer and check both visuals. The card should reflect that region. Remove the filter and confirm that the overall total returns. If every region shows the same value, check the relationship and the fields in the visual before you edit the formula. If only one region differs from the source, check a known order in that region and confirm that its lines appear once.

Try a second measure when the question changes

You can build another measure on top of Total Sales. For example, an average per order needs the total and a distinct count of order IDs when an order can have several lines. Agree on how to handle returns, canceled orders, or missing IDs before anyone uses the figure to judge performance.

If the approved source contains only valid order lines, define Order Count = DISTINCTCOUNTNOBLANK ( Sales[Order ID] ). Then create Average Order Value = DIVIDE ( [Total Sales], [Order Count] ). Use the same inclusion rules for both measures. If some rows have no order ID, resolve them or exclude them from both calculations for this measure. DIVIDE returns a blank when the count is zero.

Some measures produce totals that readers find surprising. A percentage or average is calculated again in the total filter context. Check the total against its underlying sales and order count. Suppose one region has $300 from two orders and another has $100 from one. If the regions have distinct orders, the combined average is $400 divided by three, or $133.33. A simple average of the regional results gives each region equal weight and would yield $125.

Put the measure where people can reuse it

Use the same measure across the report and give it one clear owner. When someone asks for a new definition of sales, check which visuals depend on the existing measure before changing it. In the description, record which sales amount the measure uses and how it treats returns and missing order IDs. Give future authors a check they can run when the definition changes, such as the expected total for one closed month.

For the mechanics of creating and formatting measures, see Microsoft’s measure tutorial. If you’re new to building reports, start with the Power BI beginner’s guide.

How to Create a Measure in Power BI and Check That It Works
3:53
Discussion