Learn About DAX In Power BI

Introduction

 
DAX represents Data Analysis Expressions for example such articulations or equations that are utilized for data examination and computations. These articulations are an assortment and blend of capacities, administrators, and constants that are assessed as one recipe to yield results (worth or qualities). DAX recipes are exceptionally valuable in BI instruments like Power BI as they help data examiners to utilize the informational indexes they have to the fullest potential.
 
With the assistance of the DAX language, experts can find better approaches to compute information esteems they have and thought of new bits of knowledge.
 
View some key focuses on DAX, which will help you understand the idea better.
  • DAX is a utilitarian language for example its total code is consistently a capacity. An executable DAX articulation may contain restrictive proclamations, settled capacities, esteem references, and so on.
  • DAX equations have two essential information types; Numeric and Non-numeric or Others. The numeric information type incorporates whole numbers, decimals, cash, and so forth, while the non-numeric comprises of strings and paired items.
  • DAX articulations are assessed from the deepest capacity heading off to the furthest one at the last. This makes figuring of a DAX recipe significant.

DAX Formula – Syntax

 
I have created a sample DAX formula based on sales data. You can see the formula in the below image.
 
I have explained each syntax element shown in the image in the points below:
 
Learn About DAX In Power BI
 
A: It is the name of the new measure (TotalSale).
 
B: It is the operator (equals sign =) which indicates the beginning of the DAX formula and equating each side.
 
C: It is one among the DAX function won't to the addition of a given field (Saleslastyear) from a table (Salesperson). The function used here is SUM.
 
D: The parenthesis () is employed to surround and define arguments in an expression. Every function must have a minimum of one argument.
 
E: It is the name of the table from which a field or column has taken within the formula (Salesperson).
 
F: It is the name of the Column of the table on which the formula will apply. for instance, the function SUM will apply itself to the values of the column or field [Saleslastyear] of the table Salesperson.
 
G: It is another operator used for multiplication, although the syntax elements from A to F constitute the essential syntax of DAX.
 

DAX Calculation

 
The DAX formula is also known as a DAX calculation, as it applies to an input value and returns a resultant value. There are two types of DAX calculations in Power BI
i.e. Calculated Column and Calculated measures.
 
Calculated Column
 
The calculated columns create a new column in the table. The difference between a regular column and a calculated column is that the calculated column must have at least one function. You can use this type of column when you want to create a column with filtered or sorted information.
 
To create a calculated column, follow the below steps:
  1. Go to the ‘Modeling’ tab
  2. Click on ‘New Column’, a new formula bar will open with text ‘Column=’
  3. You can replace the column by actual name and write the formula here.

    Learn About DAX In Power BI

    Learn About DAX In Power BI
Calculated Measures
 
A calculated measure creates a column having aggregated values such a sum, ratios, percentages, averages,
To create a calculated measure, follow the below steps:
  1. Go to the ‘Modeling’ tab of the Power BI tool.
  2. Click on ‘New Measures’. A formula bar will open with the default text ‘Measure=’
  3. Write your formula here in this text bar.

    Learn About DAX In Power BI

    Learn About DAX In Power BI

Summary

 
This was some small information about DAX. I hope this article will give you enough fundamental knowledge of DAX formulas. In the next article, I will explain DAX functions and will show you how to create these formulas. So stay with us and thanks for reading!