£199.99 £139.99 for one year of Unlimited learning. Offer ends on 28 February 2023 at 23:59 (UTC). T&Cs apply

Introduction to DAX

..

Introduction To DAX

Data Analysis Expressions (DAX) is a programming language that is used throughout Microsoft Power BI for creating calculated columns, measures, and custom tables. It is a collection of functions, operators, and constants that can be used in a formula, or expression, to calculate and return one or more values. In Power BI, you can use different calculation techniques and functions to create measures or calculated columns.

Use Calculated Columns
DAX allows you to augment the data that you bring in from different data sources. For example, assume that you are importing data from a database that contains sales transactions.

You can start using DAX by creating a calculated column that multiplies the unit price with the quantity. The calculated column will create a value for each row called Total Price.

The value on the left side of the equal sign is the column name. The text on the right side of the equal sign is the DAX expression. This simple DAX expression takes the quantity value and multiplies it with the unit price value for each individual row.

 Total Price = 'Sales OrderDetails'[Quantity] * 'Sales OrderDetails'[Unit Price]

 

Use Measures

Calculated columns are useful, but you are required to operate row by row.
For example, consider a situation where you want an aggregation that
operates over the entire dataset and you want the total sales of all rows.

In the Quick measures window, you can select the calculation that you want
and the fields to run the calculation against.

Similar to how you created a calculated column, you can go to the Fields
list and select New measure.

Total Sales = sum('Sales OrderDetails'[Total Price])