Understanding DAX

The syntax of DAX is not dissimilar to Excel's function language. In fact, there are a number of functions that are named and work nearly identically to Excel's formula language. However, do not be fooled by these similarities. DAX is an extremely powerful programming language that works very differently to Excel's formula language.

While Excel's formula language is optimized for dealing with cells in a spreadsheet, DAX is optimized to deal with tables of data consisting of columns and rows. Hence, unlike Excel, it is not possible to reference an individual cell within a table. Instead, you use DAX to identity a table and a column and then filter down to a single row or rows.

As mentioned previously, DAX allows for the creation of calculated columns, measures, and calculated tables. Calculated columns are columns that are added to an existing table within the data model. These columns are defined by the DAX formula entered for the column. This formula is used to create a calculated value for each row in the table.

Conversely, measures are DAX formulas that are not tied to any particular table except as referenced within the DAX formula itself. These calculations are dynamic and can change values based upon the context within which the formula is calculated. Finally, calculated tables are entire tables within the data model whose columns, rows, and values are defined by a DAX formula.

There are over 250 DAX functions that can be used in formulas and these functions can be infinitely nested to create extremely complex calculations.

All DAX formulas have the same format:

Name = Formula

The portion to the left of the equals sign becomes the name of the object created. The portion to the right of the equals sign is the actual formula calculation consisting of DAX functions and operators.

DAX functions always begin and end with parentheses. As you type, Power BI will provide contextual help, such as available function names, as well as input parameters for DAX functions. Use the Tab key to accept a suggestion and have Power BI autocomplete the remainder of the suggestion. Do not worry about DAX just yet; you will learn how to write DAX starting later in this chapter and throughout this book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.171.52