Creating Measures in Azure Analysis Services

Measures are calculations that aggregate data from your model. They are dynamic, meaning they recalculate based on the context of a query. This document guides you through creating various types of measures in Azure Analysis Services.

Understanding Measures

Measures are typically based on columns from your fact tables. They use DAX (Data Analysis Expressions) formulas to define how data should be aggregated. Common aggregation functions include SUM, AVERAGE, COUNT, MIN, and MAX.

Creating a Simple Measure

You can create measures directly in your model using tools like SQL Server Data Tools (SSDT) or Visual Studio with Analysis Services projects.

Steps:

  1. In your tabular model project, navigate to the table that contains the measures you want to create.
  2. Right-click on the table and select New Measure.
  3. The Expression Builder will open.
  4. In the Name field, enter a descriptive name for your measure (e.g., Total Sales).
  5. In the Expression field, write your DAX formula. For Total Sales, a common formula would be:
SUM(Sales[SalesAmount])

Here, Sales is the table name and SalesAmount is the column name.

  1. Click OK to create the measure.

DAX: The Language of Measures

DAX is a powerful formula language used across Power BI, Analysis Services, and Power Pivot. It allows for complex calculations and aggregations.

Common DAX Functions for Measures: