ChristianSteven BI Blog

How to Create a Measure in Power BI

Written by Christian Ofori-Boateng | Dec 1, 2023 5:28:00 PM

 

 

Learning to create a measure in Power BI is essential to get the most out of the tool. These let you perform specific calculations or summaries on your data, opening up the tool’s modeling and analytical capabilities.

Creating a measure in Power BI is an advanced skill. Therefore, you should already have a basic understanding of how Microsoft’s solution works before implementing them. For instance, you should understand how to use Get Data and Power Query Editor to import data, add fields to the report canvas, and work with multiple tables.

The following sections explain the importance of measures in Power BI and how to create new ones. You’ll learn how to explore the DAX language for creating measures in Power BI, how to add and view them, and how to automate the export and distribution of Power BI reports. Finally, you’ll receive an introduction to some best practices for writing and using measures in Power BI.

Understanding the Importance of Measures in Power BI

So, why are Power BI’s measures so essential?

The primary reason measures are critical is that they allow businesses to derive insights from their data. These enable various mathematical operations analysts to draw insights and create reports.

Part of this involves leveraging Power BI’s data modeling capabilities. Users can leverage Data Analysis Expression (DAX) to define various relationships between variables and calculations in data models. Enterprises can use these tools to build analytical tools that make sense for their objectives.

For instance, measures enable firms to create custom metrics or KPIs that more accurately capture their objectives. They also allow firms to perform time-based calculations, which is essential for the appraisal of time-series data.

Enterprises also use measures for superior data visualization. Firms can present data in various formats that all stakeholders can understand, providing an appropriate level of granularity for each group.

Creating a Measure in Power BI: Step-by-Step Guide

Power BI automatically creates measures based on the values you feed into the software. Intelligent algorithms establish which metrics are the most pertinent for your specific use case.

However, you can also make your own measures with the DAX formula language. This system allows you to construct unique calculations for reports.

Exploring the DAX Language for Creating Measures in Power BI

DAX formulas use the same functions, syntax, and operators as Excel, Microsoft’s tried-and-tested system for generating new outputs from existing data. However, DAX enables you to go deeper and perform more sophisticated calculations on the data you own.

In total, Microsoft includes more than 200 DAX functions in Power BI. These let you do everything from summing figures to performing time series and statistical filtering.

Microsoft calls the measures you make “model measures” and adds them to the Fields list for selected tables. Features allow you to give them custom names for quicker identification.

You can also make various calculations via “quick measures.” DAX will filter formulas for you, based on your inputs, saving you time.

To create these, go to the Fields window >> More options (...) >> New quick measure or navigate to the Home tab and click Calculations >> New Quick Measures.

Adding and Viewing Measures in Power BI: A Quick Tutorial

Adding new measures in Power BI first requires understanding the metric you want to capture. For example, you could calculate your business’s net profit by subtracting costs from gross profit.


Power BI won’t include this
measure automatically, so you must construct it yourself:

  1. Go to the Fields pane, hover over the table, and click More options (...). You can also right-click the table you want to use to create the measure.
  2. A menu will appear. Click New measure
  3. Power BI will create the new measure called “measure” automatically. (You can rename the measure at any point to avoid confusion). In this instance, you might want to call it “Net Profit.”
  4. Next, enter the formula using the DAX language into the prompt. Power BI helps you by providing additional prompts after you type in the first few letters of the operator you want to include. For “Net Profit”, you would type in something like Net Profit = Gross Profit - Costs. (If you need to sum revenue data or perform any other operations to get an accurate Net Profit figure, you will need to enter these at this stage. If you use any operators, Power BI will provide another drop-down suggestion list of data columns to include).
  5. If you enter an expression, ensure it opens and closes in parentheses. You should click specific columns to ensure you don’t include the wrong variables or datasets.
  6. To subtract, enter the “-” operator, ensuring you arrange the columns in the proper order.
  7. Continue to add operators until your measure takes the desired form. If you are unhappy with your entry, you can edit it at any time. Power BI lets you expand the area for formula entry by clicking on the chevron-shape arrow on the right. Press Alt+Tab to separate parts of your formula.

Once you create the measure, the next step is to include it in your report. To do this:

  1. Select the Net Profit measure from the Net Profit table
  2. Drag it to the report canvas
  3. Drag other fields, such as Location Name, to create a report
  4. View the differences in Net Profit by location or area

By the same token, you can use measures in other measures. For example, if you have Net Profit, you can use this as an input for post-EBITDA calculations or even to measure free cash.

Power BI will generally do a lot of the legwork for you. The tool aims to automate report creation, reducing the need for labor-intensive manual entry or lengthy instructions.

Writing and Using Measures in Power BI: Best Practices

While following the instructions above will help you write and use measures in Power BI, it’s not always enough. Following various best practices to ensure you provide your organization with reliable metrics and reports is also critical.

This section delves into some tips for creating the best measures possible and reducing the risk of inefficient, inaccurate work.

Organize Your Measures

Don’t leave your measures named “Measure 1,” “Measure 2,” “Measure 3,” and so on. Instead, ensure you name them accurately so you can more easily find them if you need to retrieve them for input into other measures or reports.

Optimize Measures For Performance

Use DAX operators as efficiently as possible to reduce computational load. It contains the Excel operations library, allowing you to find shortcuts to otherwise complex mathematical operations.

Use More Variables In Complex Calculations

Related to the last tip, don’t construct new variables from scratch in complicated formulas. Instead, pre-process variables with simpler measures and enter these into new measure calculations you want to perform. For example, you could calculate earnings before taxes before net profits after tax.

Use Intelligent Functions

Power BI equips its measures tool with various intelligent functions, allowing you to take analytical and computational shortcuts. For instance, “done-for-you” tools include moving averages, quarter-to-date, and year-to-date options, preventing the need for complicated programming.

Match Measures To KPIs

Power BI also lets you match measures to your enterprise’s KPIs. However, you will need to be creative in the measures you build, choosing ones that get to the crux of issues you care about.

Stay Up To Date

Finally, Microsoft regularly updates DAX with new operators, functions, and syntax. Therefore, stay up to date with the latest releases to ensure you can use all the options the tool offers.

Now You Know How to Create A Measure In Power BI

Now you’ve made it to the end of this article, you know how to create a measure in Power BI. The main difficulty is understanding how tables, columns, and measures fit together. Once you have an understanding of that, inputting the formulas is similar to Excel.

Automating the Export and Distribution of your Power BI reports: PBRS

If you want to automate the export and distribution of Power BI reports, you first need to install Power BI Reports Scheduler (PBRS). This innovative tool lets you send out reports to various organizational stakeholders at times of your choosing.

To do this:

  1. Connect your Power BI account to PBRS.
  2. Create a new report schedule in PBRS, defining the times you will send out reports and to whom. (Use the tool to create daily, weekly, monthly, quarterly, or custom schedules).
  3. Select the reports you want to include in your Power BI schedule.
  4. Choose the export type you will use (Word, Excel, HTML, PDF, etc.)
  5. Choose the “destination point” where you will send the reports. Options include email, SharePoint, FTP,  local file servers, and more.
  6. Add an optional attachment email to outline the report and provide context.
  7. Filter reports according to who you want to send them to and when.
  8. Define triggers for when reports get sent to stakeholders
  9. Save and confirm the schedule.